Page 1 of 1
convert -resize not working properly
Posted: 2013-01-23T14:33:27-07:00
by stoopkid1
hi all, i'm new to the board and absolutely love the command line ability with this software. i'm working with PHP and utilizing it's exec('') functionality. all i'm trying to do is resize an image, but i don't believe it's working properly. my original image is 1024x1026, and i am trying to resize the image to 1710 x 2200. the command i'm running is:
Code: Select all
convert -resize 1710x2200 c:\test\hpaa.jpeg c:\test\hpaa1.jpeg
the resulting image (hpaa1.jpeg) comes out to only 1710x1713. am i misusing the command, or is there another parameter i'm missing? i need the standardized image size (1710x2200) because the software my company is working on depends on that exact size (or something VERY close to it). any and all help is appreciated.
thanks.
Re: convert -resize not working properly
Posted: 2013-01-23T15:25:15-07:00
by Bonzo
You need to read the image in first:
Code: Select all
convert c:\test\hpaa.jpeg -resize 1710x2200 c:\test\hpaa1.jpeg
As to size - do you want to distort the image to fit the new size, do you want to crop the image to fit the new size, do you want to get the longest dimension to fit the new size and keep the aspect ratio or pad the image out with a background colour to fit the new size?
The resize options are here
http://www.imagemagick.org/script/comma ... p#geometry and if you want differnt result like a crop or pad you will need to explain what result you would like.
Re: convert -resize not working properly
Posted: 2013-01-23T16:30:59-07:00
by snibgo
If you want exactly 1710x2200, you need an exclamation mark. I use Windows, so the exclamation mark need to be escaped with a caret:
Code: Select all
convert c:\test\hpaa.jpeg -resize "1710x2200^!" c:\test\hpaa1.jpeg
Re: convert -resize not working properly
Posted: 2013-01-23T17:35:46-07:00
by stoopkid1
snibgo wrote:If you want exactly 1710x2200, you need an exclamation mark. I use Windows, so the exclamation mark need to be escaped with a caret:
Code: Select all
convert c:\test\hpaa.jpeg -resize "1710x2200^!" c:\test\hpaa1.jpeg
I'm on Windows as well snibgo. Thanks very much for both of your insights on my issue. I figured it was a fundamental problem I was having with the command, and not using it properly. Thank you for pointing out how to fix my problem. I'll give it a shot later this evening and report my results.