Page 1 of 1

Problem using conditional rotate

Posted: 2012-07-27T08:00:18-07:00
by megank
Hi,

I'm converting a bunch of engineering drawings and I need them all to be landscape instead of portrait. The drawings are going from PDF to JPG. I am on Windows 7 32 bit, using ImageMagick 6.7.8-4. This is for a batch script. I've read the page on distorting images and I'm still having problems, it's like the 90< is not being parsed correctly. Here is the line of code I have:

FOR %%a in ("%~dp1*.pdf") DO convert "%%a" -rotate -"90\<" -density 70 "%%~dpajpg\%%~na.jpg"

I've tried -rotate 90\< and 90< with different amounts of quotes, both single and double.

The error I get either says it can't find the file or that 90\< is not a valid argument for rotate. without the quotes it parses the file like this "-rotate 90\70 "filepath" 0<-density"

I feel like this is a dumb question but I couldn't find an example or similar problem anyone was having.

Thanks.

Re: Problem using conditional rotate

Posted: 2012-07-27T10:09:23-07:00
by fmw42
I am not an expert on windows, but \ is a unix escape and I believe that in windows you need to use ^. It may also be necessary to remove the double quotes, or remove the \ and just leave the quotes, but I am not sure. Also if you have quotes, the minus should probably be inside the quotes.

For windows syntax, see
http://www.imagemagick.org/Usage/windows/

Re: Problem using conditional rotate

Posted: 2012-07-27T10:52:24-07:00
by megank
Ohh! good point about ^, I mostly use Linux so this is very frustrating for me. I'll try it out and see if I can get something.

Problem fixed. Thanks for your help! Correct line is:

FOR %%a in ("%~dp1*.pdf") DO convert "%%a" -rotate "-90<" -density 70 "%%~dpajpg\%%~na.jpg"