Batch canvas resize in %

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: helmut, XnTriq, xnview

Post Reply
Jozef
Posts: 3
Joined: Sun Dec 09, 2007 3:51 pm

Batch canvas resize in %

Post 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?
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Batch canvas resize in %

Post 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
Jozef
Posts: 3
Joined: Sun Dec 09, 2007 3:51 pm

Re: Batch canvas resize in %

Post 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'
Photographer
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post 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
Jozef
Posts: 3
Joined: Sun Dec 09, 2007 3:51 pm

Post by Jozef »

A lot of thanks, everything works now fine.
Post Reply