Minimize space in sprites created with montage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
tirengarfio
Posts: 7
Joined: 2013-05-31T05:10:43-07:00
Authentication code: 6789

Minimize space in sprites created with montage

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Minimize space in sprites created with montage

Post 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.
Post Reply