Page 1 of 1

Batch canvas resize in %

Posted: Sun Dec 09, 2007 5:19 pm
by Jozef
I would like to resize the canvas of my images in %

My batch code and command is:
FOR %%f IN (*.jpg) DO nconvert -canvas 103% 103% -bgcolor 255 255 255 %%f

However, I receive the error: Bad position '255'

Replacing the -bgcolor 255 255 255 code gives an other error.

What am I doing wrong?

Re: Batch canvas resize in %

Posted: Sun Dec 09, 2007 9:45 pm
by helmut
The command "-canvas" expects the parameters <width> <height> <position>. In your command line width and heigth are specified, but the position (top-left, top-center, ...) is missing.

A sample for a valid command line:

Code: Select all

FOR %%f IN (*.jpg) DO nconvert -canvas 103% 103% center -bgcolor 255 255 255 %%f

Re: Batch canvas resize in %

Posted: Mon Dec 10, 2007 10:06 am
by Jozef
Yes indeed, I forgot to use pos center.

New code:

Code: Select all

FOR %%f IN (*.jpg) DO nconvert -canvas 103% 103% center -bgcolor 255 255 255 %%f 
The code with center now gives the error: Bad position '-bgcolor'

Posted: Mon Dec 10, 2007 1:52 pm
by helmut
Sorry, I haven't tested my above command in a batch script. In a batch script you have to use %% for the percent character:

Code: Select all

FOR %%f IN (*.jpg) DO nconvert -canvas 103%% 103%% center -bgcolor 255 255 255 %%f

Posted: Mon Dec 10, 2007 4:59 pm
by Jozef
A lot of thanks, everything works now fine.