Help with CANVAS and RESIZE

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

Moderators: XnTriq, xnview

Posts: 1
Joined: Fri Jun 18, 2021 10:34 am

Help with CANVAS and RESIZE

Post by kobber »

I want to process a pack of images with different scales - need to crop and resize to 4:3 scale.
For example, on screenshot: red rectangles - source images, green - desired results.

Initialy I used this command:

nconvert -ratio -resize 0 2000 -canvas 1500 2000 center -i -o dest.jpg source.jpg

It was good for one type of images, but for second - it leaves black lines on a sides of image.

Is there solution to use one line command to deal with both types of scales?
May be canvas longest, resize longest
Have no ideas...
You do not have the required permissions to view the files attached to this post.
Posts: 2998
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Help with CANVAS and RESIZE

Post by cday »

When resizing an image to a particular ratio requires new canvas to be added, the colour of the canvas added is set by the -background option:

Code: Select all

 -bgcolor red green blue: Background color (for rotate/canvas)
 -bgcolor2 red green blue alpha: Background color (for rotate/canvas)
When no colour is specified the default value may well be black.

I'm not sure looking quickly whether that is your problem, but you might take a look at that...