Page 1 of 1

moarsaic - convert a wallpaper into a mosaic

Posted: Sun Jun 28, 2015 7:54 pm
by rhowaldt
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.

Code: Select all

moarsaic mynicewall.png 8
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.

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)
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:
280615_2241.png
code: http://pastebin.com/GJd0P2gJ

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Sun Jun 28, 2015 8:07 pm
by simgin
^ Nice Rho thank you :)
Btw Where the heck did Harvey go? He was a nice kid ;(

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Sun Jun 28, 2015 9:05 pm
by pidsley
Thanks roald. Would you like to put this on the linuxbbq github? I think it could go here: https://github.com/linuxbbq/toolbox -- if you have your own git repo it could go there, of course.

simgin -- harvey is very busy with school (and I think now he is working at an externship) so he is probably doing other things.

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Sun Jun 28, 2015 9:55 pm
by rhowaldt
thanks simon and pidsley.

i would throw it on the github but that means i first need to figure out how that shit works. which is fine, but might take a bit.
in the meantime, i added the commandline flags that i still had in the todo. this all seems to work perfectly now. some stuff defaults so you don't have to give it as an argument anymore, but it is optional. for more help, see the nice shiny new -h flag :)

new code is here for now until i figure out github: http://pastebin.com/8LfmZSjw

github: https://github.com/rhowaldt/scripts/blo ... r/moarsaic

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Sun Jun 28, 2015 10:48 pm
by simgin
Ok thanks for the info Pids :)

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Mon Jun 29, 2015 12:09 am
by rhowaldt
github updated with 2 filters added to the script. so far, so good. i had a bunch more filters but didn't really see why anyone would want to rotascope their shit, so kept it with these 2. gonna keep it with this for now, i suppose.

as for the bbq github... can i just push it there or something? no idea how that works...

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Mon Jun 29, 2015 12:11 am
by wuxmedia
^^^ there now, github isn't /all/ that bad... :)
nice meaty script
heh, saw you were still fiddling with it just now :)

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Tue Jun 30, 2015 5:29 am
by Dr_Chroot
Ah yes, tasty script indeed. Dank je!

Re: moarsaic - convert a wallpaper into a mosaic

Posted: Tue Jun 30, 2015 9:14 am
by rhowaldt
^ graag gedaan :)
nice quote, too!