0

I found this description on website http://www.imagemagick.org/Usage/resize/#shrink :

Only Shrink Larger Images ('>' flag) Another commonly used option is to restrict IM so that it will only shrink images to fit into the size given. Never enlarge. This is the '>' resize option.

Example:

convert dragon.gif    -resize 64x64\>  shrink_dragon.gif

The Only Shrink Flag ('>' flag) is a special character in Window batch scripts and you will need to escape that character, using '^>', or it will not work.

So as I understand this flag ('>') could only work either on windows ^> or unix /> . Is there any way to create command that will work both on windows and unix?

I use imagemagick with php, so I've got unix on production webserver, but windows on localhost.

Thank you.

pupadupa
  • 1,530
  • 2
  • 17
  • 29
  • i was working with im years ago a lot and i remember that i ended up with having a switch `if (win) else` due to the single quotation marks and slashes or back slashes. – Kaken Bok Jul 31 '11 at 19:42

1 Answers1

1

If you are calling ImageMagick from a script, there is probably a built-in function for escaping shell arguments. In Python it's pipes.quote. In PHP it is escape_shell_arg();

Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196
  • Unfortunatly this isn't solve this problem... because I need to change shell arguments depends on operation system in which my code runs. – pupadupa Aug 26 '11 at 08:46