02/24/2013, 03:40 PM
So, I was a little bit bummed when I found out that my TouchPad didn't have fancy options for scaling or tiling wallpaper, so I wrote a set of simple BASH scripts that perform various batch operations on images to make them more TouchPad-friendly. This one center-tiles smaller images across a 1024x1024 canvas. It's not perfect, but this is the least buggy of the bunch. Here goes:
if [ ! -d ./tiled ]
for file in ./*.*
if [ $file != $0 ]
imgw=`convert $file -format "%[fx:w]" info:`
imgh=`convert $file -format "%[fx:h]" info:`
echo Tiling $file...
convert $file \( -clone 0 \) +append -write mpr:sometile +delete -size 1024x1024 -tile-offset +$xo+$yo tile:mpr:sometile tiled/$file
The processed file is placed in ../tiled because I didn't write anything in to compensate for the presence of anything other than the script and unprocessed images in the working directory. Truth be told, this is very kludgy code, but it gets the job done for the most part. Hopefully someone finds it useful. Example output made from a scaled down photo of some canned oysters is appended below.
Edit: So, for some reason smaller images and some PNGs don't tile correctly. From what I can tell, it's an ImageMagick problem, so I'm not sure what I can do about it.
Edit 2: Now tiled images are placed in a subdirectory called tiled. Will still freak out if there are non-image files in the directory, but directories and files without an extension won't freak it out anymore.