overlapping photos in single command

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
telarson

overlapping photos in single command

Post by telarson »

I'm trying to take a set of images, resize and crop the images and combine them together in a collage. I can do this in several convert commands like

#1. resize and crop commands - made up but you get the idea
convert a.jpg -resize 250x350 -gravity center -crop 50x50+50+45 +repage a1.jpg
convert b.jpg -resize 100x350 -gravity center -crop 50x50+50+45 +repage b1.jpg
...

#2. combine command
convert -page +5+10 a1.jpg -page +50+10 b1.jpg ... -mosiac out.jpg

Is it possible to do this all in one convert command?

Also, will I get a better quality image when using -draw or -page when combining png or jpegs into a single image?

Thanks,

Tait
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: overlapping photos in single command

Post by fmw42 »

telarson wrote:I'm trying to take a set of images, resize and crop the images and combine them together in a collage. I can do this in several convert commands like

#1. resize and crop commands - made up but you get the idea
convert a.jpg -resize 250x350 -gravity center -crop 50x50+50+45 +repage a1.jpg
convert b.jpg -resize 100x350 -gravity center -crop 50x50+50+45 +repage b1.jpg
...

#2. combine command
convert -page +5+10 a1.jpg -page +50+10 b1.jpg ... -mosiac out.jpg

Is it possible to do this all in one convert command?

Also, will I get a better quality image when using -draw or -page when combining png or jpegs into a single image?

Thanks,

Tait
see parenthesis processing at http://www.imagemagick.org/Usage/basics/#image_seq

(if you are on windows, see http://www.imagemagick.org/Usage/api/#windows )

try something like this (but I have not tested it):

convert -page +5+10 a1.jpg \( a.jpg -resize 250x350 -gravity center -crop 50x50+50+45 +repage \) \
-page +50+10 \( b.jpg -resize 100x350 -gravity center -crop 50x50+50+45 +repage \) -mosaic out.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: overlapping photos in single command

Post by anthony »

IF you did not use JPEG for intermediate image but used PNG or the IM insternal format MIFF instead then you would not have any quality loss.

MIFF is also useful as you can generate a pipeline of images from multiple commands to feed into a final 'merge together' command.

An example of this is in IM Examples, Layer Merging Examples
http://www.imagemagick.org/Usage/layers/#example
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
telarson

Re: overlapping photos in single command

Post by telarson »

anthony wrote:IF you did not use JPEG for intermediate image but used PNG or the IM insternal format MIFF instead then you would not have any quality loss.

MIFF is also useful as you can generate a pipeline of images from multiple commands to feed into a final 'merge together' command.

An example of this is in IM Examples, Layer Merging Examples
http://www.imagemagick.org/Usage/layers/#example

Thank you, Anthony! That was great additional advice.

-Tait
Post Reply