tyled - An image tiler
Forum rules
General talk about software - if the program is not in the repos, please links to the developer's page or github.
General talk about software - if the program is not in the repos, please links to the developer's page or github.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
tyled - An image tiler
I decided that a tiling wallpaper would be a nice idea, but couldn't find decent tools for making one.
I wrote tyled in my spare time this afternoon and have ideas for lots of new features to add if other people like it.
This is an example output of it:
Let me know what you think. :)
https://github.com/HarveyHunt/tyled/tree/develop
I wrote tyled in my spare time this afternoon and have ideas for lots of new features to add if other people like it.
This is an example output of it:
Let me know what you think. :)
https://github.com/HarveyHunt/tyled/tree/develop
- Attachments
-
- out.png (2.82 KiB) Viewed 6913 times
Re: tyled - An image tiler
I'm used to 'hsetroot -tile', but this looks pretty interesting. Thanks for sharing.
Re: tyled - An image tiler
:D :D
It's funny how we used to be able to do real stuff with rudimentary computers, but now we can't. -- ratcheer
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
What have I created?!Alad wrote::D :D
Re: tyled - An image tiler
^ Frankenstein! Lol.
No but seriously a lot of respect to you, for doing something like this in an afternoon, and for sharing it with us :o)
Simon
No but seriously a lot of respect to you, for doing something like this in an afternoon, and for sharing it with us :o)
Simon
Someone told me that I am delusional, I almost fell off my unicorn.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
Thanks Simgin, you're too nice. :)simgin wrote:^ Frankenstein! Lol.
No but seriously a lot of respect to you, for doing something like this in an afternoon, and for sharing it with us :o)
Simon
I have just added "effects" you can specify an effect on the command line using -e effect1:arg1:arg2,effect2:arg1:arg2
Currently only changing the brightness of the image works, I will add more in the future.
Re: tyled - An image tiler
looks cool harvey!
you know, i am suddenly thinking... you could take a wallpaper, use paletter to make a colour-palette out of it, then maybe use tyler to display those colours in blocks, and make that your new wallpaper...
oh well, just throwing this out there. i would look into making something like that myself if i had the inclination, but just consider it an idea that you can do whatever the fuck with (ie. use or ignore or whatever :)
you know, i am suddenly thinking... you could take a wallpaper, use paletter to make a colour-palette out of it, then maybe use tyler to display those colours in blocks, and make that your new wallpaper...
oh well, just throwing this out there. i would look into making something like that myself if i had the inclination, but just consider it an idea that you can do whatever the fuck with (ie. use or ignore or whatever :)
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.
Re: tyled - An image tiler
^ hmmm , maybe make it to somekind of mosaic ? Just a thought.
Someone told me that I am delusional, I almost fell off my unicorn.
Re: tyled - An image tiler
^ ja, that was my thought as well.
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.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
rhowaldt wrote:looks cool harvey!
you know, i am suddenly thinking... you could take a wallpaper, use paletter to make a colour-palette out of it, then maybe use tyler to display those colours in blocks, and make that your new wallpaper...
oh well, just throwing this out there. i would look into making something like that myself if i had the inclination, but just consider it an idea that you can do whatever the fuck with (ie. use or ignore or whatever :)
These are both great ideas, so I am adding them now. I am going to make it so that you can specify more than one tile to be used, as well as getting tyled to generate tiles from your xresources colours. I'll have it done by tonight. :)simgin wrote:^ hmmm , maybe make it to somekind of mosaic ? Just a thought.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
Just finished, it can now generate tiles based upon your xresources or a list of colours.
It can draw tiles in the layouts: grid, vstripe and hstripe. I will add some more later.
Here are some examples:
It can draw tiles in the layouts: grid, vstripe and hstripe. I will add some more later.
Here are some examples:
- Attachments
-
- out.png (1.19 KiB) Viewed 6848 times
-
- out.png (1.54 KiB) Viewed 6848 times
-
- out.png (1.21 KiB) Viewed 6848 times
Re: tyled - An image tiler
^ that is amazing. is it possible to randomize the tiles? the reason i ask...
i spent nearly my entire day making this:
it works, but it is slow. give it a divisor of 11 and you get this:
but that isnt even proper tiles, they are still too big.
the reason why it is so slow is because it makes a new composite image for each separate tile. a faster method is to first create separate .gif files for all the tiles, then do some type of imagemagick -tile type thing. however, i couldn't get this to work in such a way that it filled the entire screen, so i gave up on that. if there are imagemagick gurus out there: i'd love to hear some tips :)
i have also briefly looked into making hexagonal tiles, but imagemagick is still in many ways beyond me.
i spent nearly my entire day making this:
Code: Select all
#!/bin/bash
#
# GTFO license:
# this program is provided with NO GUARANTEE and NO SUPPORT
# if it breaks or does not do what you want, FIX IT YOURSELF
#
# a script for building a screen-size tile-mosaic-thingy out of the 16 colours extracted from an image.
# by rhowaldt
#
# depends: xdpyinfo, imagemagick
#FUNCTIONS AND SHIT
# SHUFFLE FUNCTION based on Knufth-Fisher-Yayes shuffle algorithm
# http://mywiki.wooledge.org/BashFAQ/026 thank you!
# takes an array[@] as input through 'shuffle ARRAY[@]', outputs arr[@]
shuffle() {
local i tmp size max rand
arr=("${!1}") # retrieve array from $1
# $RANDOM % (i+1) is biased because of the limited range of $RANDOM
# Compensate by using a range which is a multiple of the array size.
size=${#arr[*]}
max=$(( 32768 / size * size ))
for ((i=size-1; i>0; i--)); do
while (( (rand=$RANDOM) >= max )); do :; done
rand=$(( rand % (i+1) ))
tmp=${arr[i]} arr[i]=${arr[rand]} arr[rand]=$tmp
done
}
#VARIABLES AND SUCH
if [[ $# -ne 2 ]]; then
echo
echo "Your arguments are wrong."
echo "Usage: moarsaic [image] [divisor (integer)]"
exit 1
fi
IMAGE="$1"
DIVISOR=$2
x="x" #this is pathetic, but who cares?
#THE WORKINGS
echo
echo "* * * * * M O A R S A I C * * * * *"
echo
# 1. create a 16 colour palette from the given image
PALETTE=$(convert "$IMAGE" -colors 16 -format "%c" histogram:info:)
HEXLIST=$(echo "$PALETTE" | sed 's/^.*\#\(.*\) srgb.*/\1/g') #grab just the numbers
COL=("0" "8" "1" "9" "2" "A" "3" "B" "4" "C" "5" "D" "6" "E" "7" "F"); #these numbers need to be added to the front of the previous
q=0
declare -a COLOURS
while read line; do
COLOURS=("${COLOURS[@]}" "$line"); #concatenate the shit.
let q=q+1
done <<< "$HEXLIST"
echo "Image: $IMAGE"
# 2. wanna know how many tiles
read RES_X RES_Y <<<$(xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print $1, $2}') # determine screen resolution: thanksss http://superuser.com/questions/418699
SMALLEST=$(( RES_X < RES_Y ? RES_X : RES_Y )) #find the smallest side
if [[ $SMALLEST -eq $RES_X ]]; then
TILESIZE_X=$(( SMALLEST/DIVISOR )) #make sure still X=X
TILESIZE_Y=$TILESIZE_X
else [[ $SMALLEST -eq $RES_Y ]]
TILESIZE_Y=$(( SMALLEST/DIVISOR ))
TILESIZE_X=$TILESIZE_Y
fi
TILES_X=$(( ( RES_X/TILESIZE_X ) + 1 )) #the amount of tiles along one side will always be 1 greater than the amount that fits - for now
TILES_Y=$(( ( RES_Y/TILESIZE_Y ) + 1 )) #because what happens when it fits exactly...
TILES=$(( TILES_X * TILES_Y ))
echo "Screen Resolution: $RES_X$x$RES_Y"
echo "Tilesize: $TILESIZE_X$x$TILESIZE_Y"
echo "Tiles: $TILES ($TILES_X$x$TILES_Y)"
echo
# 3. get enough colours to fill all the tiles
declare -a COLOURTILES
# pick randomly from the 16-colour list, removing each pick until none are left. repeat until all tiles are filled.
while [[ ${#COLOURTILES[@]} -lt $TILES ]] #check whether we are at $TILES yet.
do
shuffle COLOURS[@] && COLOURS=${arr[1]}
for (( c=0; c<${#COLOURS[@]}; c++ )) #run through all items on shuffled colour-array
do
if [ ${#COLOURTILES[@]} -lt $TILES ] #second check to see we won't pass $TILES inside this subloop
then
COLOURTILES=("${COLOURTILES[@]}" "${COLOURS[$c]}")
fi
done
done
# 4. build a tile-mosaic-thingy out of the colours
echo "Prepare your anus. Placing colours..."
echo
convert -size "$RES_X$x$RES_Y" xc:none composite.gif # make initial image with the size of the screen
xxx=0
yyy=0
for (( i=0; i<${#COLOURTILES[@]}; i++ )) #everything in its right place
do
convert -size "$TILESIZE_X$x$TILESIZE_Y" canvas:"#${COLOURTILES[$i]}" "temp_tile_img.gif"
composite -geometry +"$xxx"+"$yyy" temp_tile_img.gif composite.gif composite.gif
rm "temp_tile_img.gif"
echo "$(($i+1)): #${COLOURTILES[$i]}"
if [[ $xxx -lt $RES_X ]]; then
xxx=$(( xxx + TILESIZE_X ))
else [[ $yyy -lt $RES_Y ]]
xxx=0
yyy=$(( yyy + TILESIZE_Y ))
fi
done
convert "composite.gif" "brand_new_tiled_wall.png"
rm "composite.gif"
exit
Code: Select all
[23:48:55]$ ./moarsaic.bash crazy_marco_koekiemonster.jpg 11
* * * * * M O A R S A I C * * * * *
Image: crazy_marco_koekiemonster.jpg
Screen Resolution: 1280x800
Tilesize: 72x72
Tiles: 216 (18x12)
Prepare your anus. Placing colours...
1: #3D4884
2: #3D3761
3: #56709A
4: #5E5171
5: #5E6A96
6: #687AA5
7: #7686AC
8: #788BC2
9: #87657B
10: #8C96B6
11: #90768E
12: #AC94A6
13: #B7B0C5
14: #C9A8B6
15: #D9D3DA
16: #ECEAEB
17: #90768E
[..]
the reason why it is so slow is because it makes a new composite image for each separate tile. a faster method is to first create separate .gif files for all the tiles, then do some type of imagemagick -tile type thing. however, i couldn't get this to work in such a way that it filled the entire screen, so i gave up on that. if there are imagemagick gurus out there: i'd love to hear some tips :)
i have also briefly looked into making hexagonal tiles, but imagemagick is still in many ways beyond me.
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.
Re: tyled - An image tiler
oh, saw you made it in Python, and just adding this to say: you are much better and faster than i am :D - i did it for fun, and didnt know that you would be trying too! coincidence? i think not.
anyway, if you can build this shit into your script so that it is programmed in a reasonable way instead of my hodge-podge style, that would probably be better :)
anyway, if you can build this shit into your script so that it is programmed in a reasonable way instead of my hodge-podge style, that would probably be better :)
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.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
rhowaldt wrote:^ that is amazing. is it possible to randomize the tiles? the reason i ask...
i spent nearly my entire day making this:
it works, but it is slow. give it a divisor of 11 and you get this:Code: Select all
[.. (some code) ..]
but that isnt even proper tiles, they are still too big.Code: Select all
[23:48:55]$ ./moarsaic.bash crazy_marco_koekiemonster.jpg 11 * * * * * M O A R S A I C * * * * * Image: crazy_marco_koekiemonster.jpg Screen Resolution: 1280x800 Tilesize: 72x72 Tiles: 216 (18x12) Prepare your anus. Placing colours... 1: #3D4884 2: #3D3761 3: #56709A 4: #5E5171 5: #5E6A96 6: #687AA5 7: #7686AC 8: #788BC2 9: #87657B 10: #8C96B6 11: #90768E 12: #AC94A6 13: #B7B0C5 14: #C9A8B6 15: #D9D3DA 16: #ECEAEB 17: #90768E [..]
the reason why it is so slow is because it makes a new composite image for each separate tile. a faster method is to first create separate .gif files for all the tiles, then do some type of imagemagick -tile type thing. however, i couldn't get this to work in such a way that it filled the entire screen, so i gave up on that. if there are imagemagick gurus out there: i'd love to hear some tips :)
i have also briefly looked into making hexagonal tiles, but imagemagick is still in many ways beyond me.
That looks awesome, I really like the output it gives. Random, but doesn't look too random.rhowaldt wrote:oh, saw you made it in Python, and just adding this to say: you are much better and faster than i am :D - i did it for fun, and didnt know that you would be trying too! coincidence? i think not.
anyway, if you can build this shit into your script so that it is programmed in a reasonable way instead of my hodge-podge style, that would probably be better :)
I will add randomness into it tonight or tomorrow, I just need to work out a nice way of doing it so that it looks like your's. :)
Hexagonal tiles will be quite tricky I think. You could use a tile that has the shape of a hexagon drawn onto it and then when a few tiles join together it makes a hexagon shape- something to think about over the next few days. :)
Re: tyled - An image tiler
^ Harvey you are doing a fantastic job mate :)
Hmmm, about the hexagon tiles, dont know how to explain it. If you could use a pattern or a tile, with no colour as a template, and let the script colour in the shapes, like a colouring book. Just an idea.
simon
Hmmm, about the hexagon tiles, dont know how to explain it. If you could use a pattern or a tile, with no colour as a template, and let the script colour in the shapes, like a colouring book. Just an idea.
simon
Someone told me that I am delusional, I almost fell off my unicorn.
Re: tyled - An image tiler
@harvey: thanks! perhaps of help to you if you want to emulate: i made the semi-random tiling by having a 16-colour array, shuffling it, then adding those colours one by one to the total stack of tiles. say you need 20 tiles, you shuffle the 16-colour array a total of 2 times: 16 + 4. i believe that is the trick to this 'look'.
looked into hexagonal stuff when looking trough imagemagick, but still havent found how to assign a rgb-colour to a canvas or some shit, really, there are so many options on imagemagick that i just cant comprehend them all. i believe it isnt possible though. or maybe it is. meh.
looking forward to seeing what other stuff you put into your script harvey, it looks really good! :)
looked into hexagonal stuff when looking trough imagemagick, but still havent found how to assign a rgb-colour to a canvas or some shit, really, there are so many options on imagemagick that i just cant comprehend them all. i believe it isnt possible though. or maybe it is. meh.
looking forward to seeing what other stuff you put into your script harvey, it looks really good! :)
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.
Re: tyled - An image tiler
P.S. i edited your post, and removed the quoting of the entire script, was a bit unnecessarily long. could've told you but figured i'd save you the effort :)
instead of quoting, you might just want to use the up-arrows like so ^^ to refer to the a post above or above that. ^^^^^ = 5 posts back reply. or just do @rhowaldt: ?
just tips, not bitchin' :D
instead of quoting, you might just want to use the up-arrows like so ^^ to refer to the a post above or above that. ^^^^^ = 5 posts back reply. or just do @rhowaldt: ?
just tips, not bitchin' :D
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.
- harveyhunt
- Haxxor
- Posts: 125
- Joined: Mon Jul 07, 2014 3:06 am
- Contact:
Re: tyled - An image tiler
rhowaldt wrote:@harvey: thanks! perhaps of help to you if you want to emulate: i made the semi-random tiling by having a 16-colour array, shuffling it, then adding those colours one by one to the total stack of tiles. say you need 20 tiles, you shuffle the 16-colour array a total of 2 times: 16 + 4. i believe that is the trick to this 'look'.
looked into hexagonal stuff when looking trough imagemagick, but still havent found how to assign a rgb-colour to a canvas or some shit, really, there are so many options on imagemagick that i just cant comprehend them all. i believe it isnt possible though. or maybe it is. meh.
looking forward to seeing what other stuff you put into your script harvey, it looks really good! :)
Ah, that is a good idea- I will get on with that at some point. Imagemagick is weirdly complicated.
I thought it might have been a little longs- thanks for fixing it for me though. :)