[Solved][IM7]Paste bigger image to smaller without cropping.

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
eustachy
Posts: 2
Joined: 2016-11-17T03:30:00-07:00
Authentication code: 1151

[Solved][IM7]Paste bigger image to smaller without cropping.

Post by eustachy »

Hello

I have a folder with scanned files in diffrent paper formats.
If file is smaller than A4 size, I need to paste it to white page in A4 size (I created a blank whie document in that size), But if the file is bigger than A4 size it is staying in his original format. So I try simple:

Code: Select all

\composite.exe" A5Image.jpg A4White.jpg ResultA4.jpg
This is great it is workiing as I want, but:

Code: Select all

\composite.exe" A3Image.jpg A4White.jpg ResultA3.jpg
Is croping to background image size - A4. That's bad.

I try several things:

Code: Select all

\composite.exe" -compose src-atop -define compose:outside-overlay=false A3Image.jpg A4White.jpg ResultA3.jpg
I try to change order:

Code: Select all

\composite.exe" -compose dst-over A4White.jpg A3Image.jpg ResultA3.jpg
This works, and I have an A3 document (Original size), but:

Code: Select all

\composite.exe" -compose dst-over A4White.jpg A5Image.jpg ResultA4.jpg
That give me A5 size document, that I need to be in A4.

Thanks for any suggestions.
Rafal
Last edited by eustachy on 2016-11-18T01:05:17-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [IM7]Paste bigger image to smaller without cropping.

Post by snibgo »

Instead of composite.exe, I would use convert.exe. The two inputs must then be reversed.

In convert.exe, use "-layers merge", eg:

Code: Select all

convert A4White.jpg A5Image.jpg -compose Over -layers merge ResultA4.jpg
snibgo's IM pages: im.snibgo.com
eustachy
Posts: 2
Joined: 2016-11-17T03:30:00-07:00
Authentication code: 1151

Re: [IM7]Paste bigger image to smaller without cropping.

Post by eustachy »

Thank You very much. It is doing what I need.
Post Reply