Page 1 of 1

Convert with extent option

Posted: 2019-07-16T00:02:38-07:00
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

Re: Convert with extent option

Posted: 2019-07-16T03:58:57-07:00
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.

Re: Convert with extent option

Posted: 2019-07-16T05:26:06-07:00
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,