Mosaic generator with k-means color palette
Generates a series of mosaics with various resolutions to simulate tile sizes as well as various color palettes. The mosaics are then stitched together into one composite mosaic. See the sample images for examples.
By default, the colors used in the image will be generated by the ImageBasedColorPaletteGenerator, which uses k-means clustering to select an optimal palette. This makes use of the Java Machine Learning (javaml) library, which is included with this project. Other palette generators are also included, eg the ManualColorPaletteGenerator, which allows the user to specify the colors to be used.
BUILDING:
The included jarfile may work for you, but if you wish to build the project, use Ant: ant build, which will create the mosaic.jar
Alternatively, you can use Maven, which will generate a ./target with the mosaic jar, jar with sources and javadoc. For example, mvn clean package
RUNNING:
To use from the command line:
java -jar mosaic.jar <imgUrl> <numColors> <widths>
For example, to generate an array of mosaics using 4, 8 and 12 colors that are 50, 100, and 200 pixels wide:
java -jar mosaic.jar https://mysite.com/myimage.png 4,8,12 50,100,200
You images will be saved in the ./generated_mosaics directory, relative to wherever you executed the jar.
USE AS LIBRARY:
The MosaicGenerator class exposes methods in order to make integration into other applications possible. These methods are documented in the MosaicGenerator class and allow you generate single mosaics and composite mosaics (sets of images showing the permutations of the specified color palettes and resolutions).