Page 1 of 1

Minimize space in sprites created with montage

Posted: 2013-05-31T05:17:45-07:00
by tirengarfio
Hi,

I want to create an sprite that contains all the pngs of my website. So I used this:

montage -background None -geometry +4+4 telicon.png montage.png montage.png

It works but it is leave gaps between the images..

Is thre any way to optimize the space to get something like this?

http://www.canalonesbastimar.com/images/sprites.png

I create that image using an online tool called "zerosprites". As some says here, that tool uses an algorithm called "VLS floorplanning".

Javi

Re: Minimize space in sprites created with montage

Posted: 2013-05-31T09:20:11-07:00
by fmw42
the spacing is defined by the sizes of the images and -geometry. If you set -geometry +0+0, then you have minimum space -- actually no space, but only if the images are the same size. otherwise the image sizes will be different and will leave space because they are arranged in equal number of images per row. If you have different size images, then you need to composite them at the desired coordinates to get them aligned as close as possible.

see
http://www.imagemagick.org/Usage/layers/#convert

There is no automated way. You must compute the offsets for placement.