Page 1 of 1

Re: generating multiple tile zoom levels from a single convert

Posted: 2009-06-18T15:18:14-07:00
by fmw42
try something like this. Using 512x512 mandril2.png and cropping out 128x128 tiles. This makes 16 tiles at level A and 4 tiles at level B.

convert mandril2.png \
\( -clone 0 -crop 128x128 +repage -write mandril2A.jpg \) \
\( -clone 0 -scale 50% -crop 128x128 +repage -write mandril2B.jpg \) \
null:

If you leave off the +repage, then the tiles keep their virtual canvas positions so that they can be put together later after further processing on each. See http://www.imagemagick.org/Usage/crop/#crop_tile (But I am not sure you can use jpg and have it carry the virtual canvas information - use gif or png as I believe those work)


(I believe that IM supports a tiled pyramid TIF format as well, so should/could make them automatically?)

Re: generating multiple tile zoom levels from a single convert

Posted: 2009-06-18T23:08:03-07:00
by anthony
There was a change recently where you can generate and insert a special percent-escape string into the output file name...
http://www.imagemagick.org/Usage/files/#save_escapes

With this you can use a %[fx;...] to name the tiled images more appropriatally.

Hmmm...

convert rose: -crop 20x20 +repage rose_%02d.gif

produces images from rose_00.gif to rose_11.gif which is not very nice.

BUT....

convert rose: -crop 20x20 \
-set filename:tile "%[fx:page.x/20+1]_%[fx:page.y/20+1]" \
+repage +adjoin "rose_%[filename:tile].gif"

produced images rose_1_1.gif to rose_4_3.gif

Their is no formatting of the tile number at this time unfortunately :-(