resize & 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?".
Post Reply
errx
Posts: 4
Joined: 2011-10-27T07:25:00-07:00
Authentication code: 8675308

resize & append

Post by errx »

I have first image with dimensions:30x40 and second 500x200

I want to append small image to the big one (using -append) but before appending I want to resize canvas (not image) of the small image to second image dimensions (500x200). Is it possible to do this with a single command?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: resize & append

Post by fmw42 »

errx wrote:I have first image with dimensions:30x40 and second 500x200

I want to append small image to the big one (using -append) but before appending I want to resize canvas (not image) of the small image to second image dimensions (500x200). Is it possible to do this with a single command?

Depends upon how you want it centered and what background color for the canvas. Here is one example

convert largeimage smallimage \
\( -clone 0 -fill white -colorize 100% \) \
\( -clone 2 -clone 1 -gravity center -compose over -composite \) \
-delete 1 -append resultimage

These are Unix command syntax. For windows see http://www.imagemagick.org/Usage/windows/

see
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/canvas/#blank
Post Reply