0 vote down star
using the latest version of imageMagick for windows (downloaded today)
small_image.jpg = 16x16
large_image.jpg = 800x600
convert small_image.jpg -gravity Center -resize '208x120>' -background white -extent 208x120 s_icon.gif
produces: "convert: invalid geometry `'208x120' @ geometry.c/ParseRegionGeometry/1322" yet it still produces a 208x120 image with the tiny 16x16 image perfectly centered within the new image and canvas size. Perfect.
However, if I try it with the larger image, it gives me the same error but it actually seems to crop rather than scale down as the "208x120>" implies.
What is that error, how do I fix it and why doesn't this command line work for larger images?
What I'm trying to do is rescale while keeping aspect ratio to around 208x120 then forcing paddding around any extra space to create an exactly 208x120 pixel image. Smaller images should just be place in the center without sizing up and larger images shrunk to the new size.
ImageMagick and Geometry Issue - resizing with >
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick and Geometry Issue - resizing with >
try placing -gravity center after -resize
do you have any virtual canvas with your image?
try
convert small_image.jpg +repage -resize '208x120>' -gravity Center -background white -extent 208x120 s_icon.gif
convert large_image.jpg +repage -resize '208x120>' -gravity Center -background white -extent 208x120 s_icon.gif
the +repage may or may not be necessary
see http://www.imagemagick.org/script/comma ... p#geometry and http://www.imagemagick.org/Usage/resize/#resize
P.S. Your command using the logo: image works fine for me on IM 6.5.6-3 Q16 Mac OSX Tiger
convert logo: -gravity Center -resize '208x120>' -background white -extent 208x120 logo_tmp1.png
do you have any virtual canvas with your image?
try
convert small_image.jpg +repage -resize '208x120>' -gravity Center -background white -extent 208x120 s_icon.gif
convert large_image.jpg +repage -resize '208x120>' -gravity Center -background white -extent 208x120 s_icon.gif
the +repage may or may not be necessary
see http://www.imagemagick.org/script/comma ... p#geometry and http://www.imagemagick.org/Usage/resize/#resize
P.S. Your command using the logo: image works fine for me on IM 6.5.6-3 Q16 Mac OSX Tiger
convert logo: -gravity Center -resize '208x120>' -background white -extent 208x120 logo_tmp1.png
Last edited by fmw42 on 2009-09-21T16:59:34-07:00, edited 2 times in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ImageMagick and Geometry Issue - resizing with >
JPG's do not store any virtual canvas information.
It seems to work perfectly find for me.
Only larger images are resized, no cropping, white padding.
what does your Im say for
It seems to work perfectly find for me.
Only larger images are resized, no cropping, white padding.
what does your Im say for
Code: Select all
convert -version
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: ImageMagick and Geometry Issue - resizing with >
I tried what you suggested but I still get this:
convert: invalid geometry `'208x120' @ geometry.c/ParseRegionGeometry/1322.
The version I get when I do -version is:
Version: ImageMagick 6.5.6-4 2009-09-21 Q16 OpenMP
convert: invalid geometry `'208x120' @ geometry.c/ParseRegionGeometry/1322.
The version I get when I do -version is:
Version: ImageMagick 6.5.6-4 2009-09-21 Q16 OpenMP
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ImageMagick and Geometry Issue - resizing with >
The quoting seem to indicate some problem. Ar you using windows?
If so swicth your quote characters from ' to "
See IM Examples, Windows Scripting API
http://www.imagemagick.org/Usage/windows/
If so swicth your quote characters from ' to "
See IM Examples, Windows Scripting API
http://www.imagemagick.org/Usage/windows/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: ImageMagick and Geometry Issue - resizing with >
Man. All this pain over a '
This issue seriously needs to be in the FAQ or in the manual somewhere in a conventions section or something. If it is, it surely needs to bubble up to the top.
Thanks guys for all the help.. this solved it!
This issue seriously needs to be in the FAQ or in the manual somewhere in a conventions section or something. If it is, it surely needs to bubble up to the top.
Thanks guys for all the help.. this solved it!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick and Geometry Issue - resizing with >
FYI, it is in the file Anthony mentioned which is clearly listed and linked on his main page (at http://www.imagemagick.org/Usage) titled as Usage Under Windows. It says:
Most often, double quotes '"' have need to be used in place of single quotes ''' so that the command arguments remain correct. Watch out for quotes within quotes such as in "-draw" operator. You can use single quotes within a DOS double quoted argument as these are passed to IM for handling, and not the DOS scripting language.
Sorry I know little about Windows, but find Anthony's pages very helpful and try to point Windows users to this file when I recognize such an issue. Sorry if I did not catch that sooner. By habit even on Mac/Unix, I almost always use double quotes (to allow variables to be used inside them).
Most often, double quotes '"' have need to be used in place of single quotes ''' so that the command arguments remain correct. Watch out for quotes within quotes such as in "-draw" operator. You can use single quotes within a DOS double quoted argument as these are passed to IM for handling, and not the DOS scripting language.
Sorry I know little about Windows, but find Anthony's pages very helpful and try to point Windows users to this file when I recognize such an issue. Sorry if I did not catch that sooner. By habit even on Mac/Unix, I almost always use double quotes (to allow variables to be used inside them).