Convert and resize together

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
indusam
Posts: 3
Joined: 2019-03-03T09:05:09-07:00
Authentication code: 1152

Convert and resize together

Post by indusam »

Hello everyone!
I need to put one image (overlay 2748x820 px) on another (background 1000x1000 px). During this operation I want to change overlay size intentionally and preserve background's size change
So I try to use such line (Win 8.1, x64, command line):

magick convert background.jpg \( overlay.png -gravity center -resize 200 \) -composite result.jpg

but it changes both the size of overlay and backround images so that result image is 200x200 px while I want have result image 1000x1000 px (like background) and overlay image 200x60 px in the center of it.

is it possible? thanks for your help in advance
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert and resize together

Post by snibgo »

You have \( \and \). Those escapes are needed for bash. They are not correct for Windows. Use just ( and ) .
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and resize together

Post by fmw42 »

Also for ImageMagick 7, use just magick and not magick convert. Other tools such as identify, mogrify, etc do need to be prefaced by magick, but not convert. When removing the \s, be sure to keep the space on each side of each parenthesis.
indusam
Posts: 3
Joined: 2019-03-03T09:05:09-07:00
Authentication code: 1152

Re: Convert and resize together

Post by indusam »

snibgo wrote: 2019-03-03T09:57:02-07:00 You have \( \and \). Those escapes are needed for bash. They are not correct for Windows. Use just ( and ) .
you are absolutelly right! in this way it works properly! thank you! :D
indusam
Posts: 3
Joined: 2019-03-03T09:05:09-07:00
Authentication code: 1152

Re: Convert and resize together

Post by indusam »

fmw42 wrote: 2019-03-03T12:11:05-07:00 Also for ImageMagick 7, use just magick and not magick convert. Other tools such as identify, mogrify, etc do need to be prefaced by magick, but not convert. When removing the \s, be sure to keep the space on each side of each parenthesis.
on my PC it do nothing without 'magick'
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and resize together

Post by fmw42 »

You need magick, but not convert

Code: Select all

magick background.jpg ( overlay.png -gravity center -resize 200 ) -composite result.jpg
Post Reply