Convert with extent option

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
MisterJpa
Posts: 11
Joined: 2018-07-23T02:32:48-07:00
Authentication code: 1152

Convert with extent option

Post by MisterJpa »

Hello,

I'm trying to resize an image by adding a white band on the top of the image.
My original is a usually a square of 4000x4000.
The expected result is an image of 336x420 with the ogirinal in 336x336 on the bottom and white back on the top on 336x84.

I have written this command using documentation and other command I found on internet :

Code: Select all

magick convert test.jpg -resize 336x420 -background white -gravity south -extent 336x420 testconvert.jpg
I'm facing this error :

Code: Select all

convert: invalid argument for option '-extent': 336x420 testconvert.jpg @ error/convert.c/ConvertImageCommand/1575.
I don't understand why because all examples I found with -extent option are having the same kind of parameter.

My current Image Magick version :

Code: Select all

Version: ImageMagick 7.0.8-21 Q16 x86_64 2018-12-28 https://imagemagick.org
Many thanks by advance for you help,
Regards
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert with extent option

Post by snibgo »

What version of IM, on what platform?

For IM v7, I suggest you use "magick", not "magick convert". But that isn't the problem.

I don't see why you get that error from that command. You will get it from this faulty command:

Code: Select all

magick convert test.jpg -resize 336x420 -background white -gravity south -extent "336x420 testconvert.jpg"
It could also happen if the space between "336x420" and "testconvert.jpg" wasn't actually the space character.
snibgo's IM pages: im.snibgo.com
MisterJpa
Posts: 11
Joined: 2018-07-23T02:32:48-07:00
Authentication code: 1152

Re: Convert with extent option

Post by MisterJpa »

Hello Snibgo,

Thanks for you answer.
It seems that one of the spaces was KO. I have removed the spaces and rewrite them and the command is now working:
I have also remove the convert :

Code: Select all

magick test.jpg -resize 336x420 -background white -gravity south -extent 336x420 testconvert2.jpg
Thanks for the tips,
Regards,
Post Reply