moarsaic - convert a wallpaper into a mosaic
Posted: Sun Jun 28, 2015 7:54 pm
remember harvey's tyled?
in that thread i made this post about making a similar thing with bash and imagemagick. i continued it and have a first, working, version.
it's called moarsaic.
it works as such.
the 8 at the end specifies the divisor, which means it helps determine the size of each tile. this means that if you make this very big, you will end up with many tiles, which will slow your shit down and in one experiment hung my laptop. so there's a warning in there for when you want to make 1000+ tiles.
the script takes the image and
1. calculates the amount of tiles needed to fill the screen with the given divisor
2. extracts a colour palette (just like paletter does)
3. maps the palette randomly to the tiles
4. saves the image and pops up a feh-window showing a side-by-side view of original and result
with large images this might take a longer time, and it is possible to resize the image before processing. note however that this wil lead to a loss of pixels and thus a loss of colour. you will notice this in the vibrancy of the individual colours, especially when making a side-by-side comparison of results with different resizes. for now, i've left the resizing off for best results.
the final feh-popup should be optional. there are a bunch of other things i want to build in as well. you can find them in the code but here's a list for ease.
i have already been working on the filter as well. imagemagick can do some cool shit. but more of that later.
here's a scrot of moarsaic in action: code: http://pastebin.com/GJd0P2gJ
in that thread i made this post about making a similar thing with bash and imagemagick. i continued it and have a first, working, version.
it's called moarsaic.
it works as such.
Code: Select all
moarsaic mynicewall.png 8
the script takes the image and
1. calculates the amount of tiles needed to fill the screen with the given divisor
2. extracts a colour palette (just like paletter does)
3. maps the palette randomly to the tiles
4. saves the image and pops up a feh-window showing a side-by-side view of original and result
with large images this might take a longer time, and it is possible to resize the image before processing. note however that this wil lead to a loss of pixels and thus a loss of colour. you will notice this in the vibrancy of the individual colours, especially when making a side-by-side comparison of results with different resizes. for now, i've left the resizing off for best results.
the final feh-popup should be optional. there are a bunch of other things i want to build in as well. you can find them in the code but here's a list for ease.
Code: Select all
# TODO: create flags for
# --cols [NUM] # amount of colours to grab from original
# --resize # resize image before processing (faster)
# --view # open resulting image in feh
# --compare # open original + resulting image in feh side-by-side
# --output # filename
# --filter # send output through filter (separate script)
here's a scrot of moarsaic in action: code: http://pastebin.com/GJd0P2gJ