Page 1 of 1

Need proper -resize option

Posted: 2012-02-13T02:50:13-07:00
by Oldrich
Excuse, pleas my bad English!
I have my own program and wish use ImageMagick in it. I have problem with correct using -resize parameters.
In my program there I have function and say to it target dimensions width x height and then boolean parameter Zoom which means:
TRUE = enlarging is allowed with aspect ratio respecting , FALSE = enlarging is not allowed (then the source dimensions can be made smaller to target dimensions with aspect ratio respecting, but not enlarged- and the picture must not change ). My question is: Can you advice me appropriate option for -resize?
Thank You
Oldrich

Re: Need proper -resize option

Posted: 2012-02-13T04:46:49-07:00
by Drarakel
In ImageMagick, just specify the target dimensions (or only one dimension). The 'zoom TRUE' mode in your program is the default in ImageMagic, so to speak. If you need that 'zoom FALSE' mode, add the ">" sign to the target dimensions.

For example:
convert input -resize "500x>" output
That resizes to a width of 500 px (aspect ratio preserved) - but enlarging is not allowed.
http://www.imagemagick.org/script/comma ... p#geometry

Re: Need proper -resize option

Posted: 2012-02-14T01:50:53-07:00
by Oldrich
I thank you very much, -resize option works properly in my Window-program for stamp-collectors.
Another formal questions - most examples for Imagemagick are for Linux. In Windows there is a couple of problems. Is it not there a discussion group for Windows user? I study all exemples on Internet, but there are only a few. There are problems with % and ^ signs not only in cmd.exe and .bat files but in process creating and starting with parameters in Delphi - there are not common rules unambigous.

And another question - I made with Imagemagick 3D Cube with photos and placed small imagemagick logo to it . Is it allowed? If not, I take it away, I wish not to have problems.
My web page is: http:// www.oplateko.cz.

Oldrich.

Re: Need proper -resize option

Posted: 2012-02-14T06:31:38-07:00
by Drarakel
Regarding the Windows command line problems:
Oldrich wrote:There are problems with % and ^ signs not only in cmd.exe and .bat files but in process creating and starting with parameters in Delphi - there are not common rules unambigous.
Some special characters (especially "^", ">", "<", also line breaks, etc.) need to be either quoted or 'escaped' (with "^" before every special sign). I usually use the quotes. (See the resize example above where I quoted the "500x>" argument.)
The "%" characters are no problem at the normal command line, but you have to double these ("%%") if you use the commands in a batch file.

You can read a lot of useful hints e.g. here:
http://www.imagemagick.org/Usage/windows/#conversion
But of course you will have to try some things. (I would recommend: first at the command line, and if that works, then - if needed - try it somewhere else, e.g. in Delphi. In Delphi, you probably have to quote/escape the same special characters for Windows - but on top of that you probably have to escape some additional special characters for Delphi, so that Windows gets the 'correct' command.)