Hi,
We are trying to convert a image to specific size 500X500 but the output image is having different dimensions.
Ex:
Before conversion:
C:\Users\carterj>identify -verbose C:\Users\carterj\Desktop\IMG_1557.JPG
Image: C:\Users\carterj\Desktop\IMG_1557.JPG
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 2448x3264+0+0
Command used:
convert C:\Users\carterj\Desktop\IMG_1557.JPG -resize 500X500 C:\Users\carterj\Desktop\IMG_1557_1.JPG
convert -resize 500X500 C:\Users\carterj\Desktop\IMG_1557.JPG C:\Users\carterj\Desktop\IMG_1557_2.JPG
After conversion:
C:\Users\carterj>identify -verbose C:\Users\carterj\Desktop\IMG_1557_1.JPG
Image: C:\Users\carterj\Desktop\IMG_1557_1.JPG
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 375x500+0+0
We need the output image to have 500X500 dimensions.
Are there any specific options for converting image to specified dimensions......
Thanks in advance.
Regards,
Carter J
Unable to generate Output image with specified dimensions
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Unable to generate Output image with specified dimensions
Imagemagick by default preserves the aspect ratio of the image. So if your image is not square, you will get a rectangle for the result of the same aspect ratio of the input. You have 3 choices. 1) crop the image to be square. 2) extend the image to be square with some backround color. 3) force the image to distort to the desired square size.
Unix syntax:
1) convert image -resize 500x500^ -gravity center -crop 500x500+0+0 +repage result
2) convert image -resize 500x500 -gravity center -background somecolor -extent 500x500 result
3) convert image -resize "500x500!" result or convert image -resize 500x500\! result
On Windows, I think it would be
1) convert image -resize 500x500^^ -gravity center -crop 500x500+0+0 +repage result
2) convert image -resize 500x500 -gravity center -background somecolor -extent 500x500 result
3) convert image -resize "500x500!" result or convert image -resize 500x500^!
See
http://www.imagemagick.org/Usage/thumbnails/#square
http://www.imagemagick.org/script/comma ... p#geometry
Unix syntax:
1) convert image -resize 500x500^ -gravity center -crop 500x500+0+0 +repage result
2) convert image -resize 500x500 -gravity center -background somecolor -extent 500x500 result
3) convert image -resize "500x500!" result or convert image -resize 500x500\! result
On Windows, I think it would be
1) convert image -resize 500x500^^ -gravity center -crop 500x500+0+0 +repage result
2) convert image -resize 500x500 -gravity center -background somecolor -extent 500x500 result
3) convert image -resize "500x500!" result or convert image -resize 500x500^!
See
http://www.imagemagick.org/Usage/thumbnails/#square
http://www.imagemagick.org/script/comma ... p#geometry