centered append

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?".
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: centered append

Post by anthony »

RetroJ wrote:There may be a documentation bug at: http://imagemagick.org/Usage/montage/#append. It says the following:
Montage can use use for appending images with centering, without gaps between the images.
Already fixed up.

Also the notes about the use of montage append. which is not really a supported technique, as I mentioned. Just one someone discovered, and I made notes about. With this discussion I revised those notes with the comment I made earlier about the first image needing to be the tallest/widest for it to work. I'll see about adding -gravity usage to -append, but no guarantees.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: centered append

Post by anthony »

Next release of IM will now have append understand gravity. IM Examples have been updated, though both may take a day or two to be available.

Note: -gravity 'North' or 'South' will also do the same for a 'Center' top-down append, though the image will always be appended below the previous one. EG: 'North' appends the image 'South' of the previous image :-)

If you really want a north append (or East append for left-right), you should -reverse the image order.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
RetroJ
Posts: 108
Joined: 2006-10-25T08:12:50-07:00

Re: centered append

Post by RetroJ »

magick wrote:ImageMagick 6.4.7 has support for -gravity -append.
That's great. Thank you. I look forward to trying it.
RetroJ
Posts: 108
Joined: 2006-10-25T08:12:50-07:00

Re: centered append

Post by RetroJ »

anthony wrote:Next release of IM will now have append understand gravity. IM Examples have been updated, though both may take a day or two to be available.
Great to hear. Thank you.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: centered append

Post by anthony »

Of course I would still like to have the ability to organize multiple images in different ways...
  • append with a 'fixed' space' between.
    Though that can be done using -splice to add the space before appending, then -chop to remove the space on the last (or first) image.
  • append into constant 'tile' space
    This can be done by using thumbnail techniques to size all the images to a 'fixed' size (by resize and appropriate padding).
  • array {tile}
    find the largest 'image' (they should be all the same size for this) and tile them as per 'montage' -tile into one or more images. (NOT DIRECTLY POSIBLE IN "convert")
  • line fill append.
    Append images line by line (or column by column) according to gravity until the given -size limit is reached. The gravity may specify vertical aligning along a line, and horizontal alignment (justification) of the lines being appended. vertical limits could cause multiple 'pages' of images like montage does.
    (NOT DIRECTLY POSIBLE IN "convert" or "montage")
  • filled justifyed line fill append.
    like the above but the excess space is divided up as equally as posible between the images in each line.
    (NOT DIRECTLY POSIBLE IN "convert" or "montage")
  • Packed Images
    try to pack as many images into a given space. There are lots of algorithms for this, and image order may be ignored. Suggestions of 'pack' styles, my be needed.
As you can see the first two possibilities are already possible, the third exists but only in montage (should be moved into the core library), while the last three currently does not exist in IM at all. though should be reasonably simple to add.


Any one else have any ideas. Especially other 'packing' styles.

WARNING: the 'ideal' pack of images to the smallest space possible is known as a NP-complete problem. That means doubling the number of images involved (of random size) can take more than four times the amount of computation needed to solve.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: centered append

Post by fmw42 »

According to the note above:
ImageMagick 6.4.7 has support for -gravity -append.

And the changelog says:
2008-12-04 6.4.6-9 Anthony <A.Thyssen@griffith...>
AppendImage() re-written to respect gravity properly! Routine simplified to a single loop for both styles of append


But in IM 6.4.7-0, I tried:

convert rose.jpg zelda3.jpg cyclops.jpg -gravity center +append tmp.png

and the result was tmp-0.png, tmp-1.png and tmp-2.png all just the input images.

So did this development not make it to IM 6.4.7? If so, then sorry if I am premature in checking this!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: centered append

Post by anthony »

The changelog is wrong. I copied the previous entry, and obviously Cristy released his 'initial but incomplete' method as 6.4.7-0 I'll update change log and IM Examples appropriately.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply