moarsaic - convert a wallpaper into a mosaic

Submitted scripts and programs
Forum rules
Your own work only.
User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

moarsaic - convert a wallpaper into a mosaic

Unread post by rhowaldt » 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.

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
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by simgin » Sun Jun 28, 2015 8:07 pm

^ Nice Rho thank you :)
Btw Where the heck did Harvey go? He was a nice kid ;(
Someone told me that I am delusional, I almost fell off my unicorn.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by pidsley » Sun Jun 28, 2015 9:05 pm

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.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by rhowaldt » Sun Jun 28, 2015 9:55 pm

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
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by simgin » Sun Jun 28, 2015 10:48 pm

Ok thanks for the info Pids :)
Someone told me that I am delusional, I almost fell off my unicorn.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by rhowaldt » Mon Jun 29, 2015 12:09 am

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...
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
wuxmedia
Grasshopper
Posts: 6447
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by wuxmedia » Mon Jun 29, 2015 12:11 am

^^^ there now, github isn't /all/ that bad... :)
nice meaty script
heh, saw you were still fiddling with it just now :)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by Dr_Chroot » Tue Jun 30, 2015 5:29 am

Ah yes, tasty script indeed. Dank je!
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: moarsaic - convert a wallpaper into a mosaic

Unread post by rhowaldt » Tue Jun 30, 2015 9:14 am

^ graag gedaan :)
nice quote, too!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

Post Reply