Appending/Tiling with max width or height
Posted: 2011-07-19T07:53:30-07:00
Running into an issue with multi-file creation for image appending. Say I have either of the two queries:
Both do the same thing, a vertical tile of the images, but they do it on a single image. I want to be able to append these images with a maximum height in mind. However, since these *.jpg files have a variable height, crop isn't appropriate here. Instead, I want ImageMagick to say: "If this next image would go beyond the maxHeight, then save the existing destination image, and start a new one." Montage seems like it almost has the option, but not quite:
The first one is a real command, but you have no idea what the number of images should be (and that could change from each multi-image destination). The second one isn't real, but it's exactly what I want. I've tried just about every geometry parameter under the sun, and they either mess with the source images (resize, add blank space, etc.), or just don't do anything. I want to declare the maximum canvas size (or at least the height), not resize it, or mess with the graphic primitives.
If this isn't possible from a single command line, can it be done with a script that uses identify %h or something along those lines? I'm tired of having to play around with letter starters all the time:
Code: Select all
convert dir/*.jpg -append appended-%d.jpg
montage dir/*.jpg -tile 1x -mode Concatenate appended-%d.jpg
Code: Select all
montage dir/*.jpg -tile 1x20 -mode Concatenate appended-%d.jpg
montage dir/*.jpg -tile 1x(3000px) -mode Concatenate appended-%d.jpg
If this isn't possible from a single command line, can it be done with a script that uses identify %h or something along those lines? I'm tired of having to play around with letter starters all the time:
Code: Select all
convert dir/[a-c]*.jpg -append appended-1.jpg
convert dir/[d-fF]*.jpg -append appended-2.jpg
convert dir/[g-j]*.jpg dir/k[a-e]*.jpg -append appended-3.jpg
convert dir/k[f-z]*.jpg dir/[l-n]*.jpg -append appended-4.jpg
...etc...