montage - pack images

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
stuaxo

montage - pack images

Post by stuaxo »

Hi,
It'd be really useful for j2me development if montage had two things:
1. pack mode
Pack images in as tightly as possible
1b pack mode with overlap (if it is safe, overlap the images i.e. if two images have a line of white pixels at the start and end).

2. output the filename, x, y, width, height for each file placed in the new image.

With this it would be a very useful tool :)

Cheers.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: montage - pack images

Post by magick »

The closest we have to pack is -mode concatenate.

Add -verbose to your command line to list the image file names and their offsets. You can also use this command:
  • identify -verbose montage.miff
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: montage - pack images

Post by fmw42 »

I found that you can overlap images, if somewhat tricky, by using negative offsets for the -geometry parameter.

See another recent post:

viewtopic.php?f=1&t=11176
stuaxo

Re: montage - pack images

Post by stuaxo »

Hm, yes I tried concatenate, but when the images are different sizes big gaps appear negating any size benefits.

For the moment, I'm looking at just using montage on groups of images the same size.

Just tried verbose, and it doesn't give pixel coordinates of the images; I assume their added left-to-right, top-to-bottom.

Is there anywhere I could post an RFE for the packing? I'm looking at integrating this into a build environment, so the idea is to not have to manually adjust images geometry etc.

(Or does anyone know of some other tool that could do this?)
stuaxo

Re: montage - pack images

Post by stuaxo »

Update: Found this python image packer which I'm having a look at
http://aspn.activestate.com/ASPN/Cookbo ... ipe/442299

Update2: This doesn't do the efficient packing I need :(
stuaxo

Re: montage - pack images

Post by stuaxo »

magick wrote:The closest we have to pack is -mode concatenate.

Add -verbose to your command line to list the image file names and their offsets. You can also use this command:
  • identify -verbose montage.miff
By offsets I really meant placement - is there no way to see where it's put the files, or do I have to calculate it myself ?

Heres some output I get:

montage -verbose -mode concatenate offline.png online.png ../tmp/grid_12x12.png
offline.png PNG 12x12 12x12+0+0 8-bit DirectClass 636b
online.png PNG 12x12 12x12+0+0 8-bit DirectClass 646b
Post Reply