Page 1 of 2
Help with CANVAS and RESIZE
Posted: Fri Jun 18, 2021 10:48 am
by kobber
Hello.
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.

- 222.jpg (7.98 KiB) Viewed 12561 times
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...
Re: Help with CANVAS and RESIZE
Posted: Fri Jun 18, 2021 11:30 am
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...
Re: Help with CANVAS and RESIZE
Posted: Wed May 18, 2022 9:39 am
by bll06
Hello,
The -bgcolor and -bgcolor2 doesn't work when i use -keepcspace option. My original picture have a 32bit color depth.
For example :
nconvert -q 85 -ratio -rtype lanczos -rflag orient -keepcspace -resize longest 1000 -bgcolor 255 255 255 -canvas 1000 1000 center -out jpeg -o "C:\TEMP\photo1.JPG" "C:\MEDIATHEQUE\photo.EPS"
The added background get a random color.
Any ideas?
Thanks
Re: Help with CANVAS and RESIZE
Posted: Wed May 18, 2022 9:54 am
by cday
You want to keep 32-bit depth, or output a 24-bit image with a selected background color? In the latter case, you could test including a term to set the bit depth to 24-bit.
Re: Help with CANVAS and RESIZE
Posted: Wed May 18, 2022 10:00 am
by bll06
cday wrote: Wed May 18, 2022 9:54 am
You want to keep 32-bit depth, or output a 24-bit image with a selected background color? In the latter case, you could test including a term to set the bit depth to 24-bit.
I need to keep 32-bits depth.
Re: Help with CANVAS and RESIZE
Posted: Wed May 18, 2022 10:25 am
by cday
bll06 wrote: Wed May 18, 2022 10:00 am
I need to keep 32-bits depth.
You might look at
this recent thread for ideas if you haven't already done so.
I don't have much experience with 32-bit, but when I had a quick look at the poster's problem using XnConvert, I also obtained an output file with a green background.
Otherwise you will have to wait for Pierre the developer of NConvert.
Re: Help with CANVAS and RESIZE
Posted: Thu May 19, 2022 11:07 am
by xnview
and if you use
Code: Select all
nconvert -q 85 -ratio -rtype lanczos -rflag orient -resize longest 1000 -bgcolor 255 255 255 -canvas 1000 1000 center -out jpeg -o "C:\TEMP\photo1.JPG" "C:\MEDIATHEQUE\photo.EPS"
why do you want -bgcolor?
Re: Help with CANVAS and RESIZE
Posted: Fri May 20, 2022 1:08 pm
by bll06
xnview wrote: Thu May 19, 2022 11:07 am
and if you use
Code: Select all
nconvert -q 85 -ratio -rtype lanczos -rflag orient -resize longest 1000 -bgcolor 255 255 255 -canvas 1000 1000 center -out jpeg -o "C:\TEMP\photo1.JPG" "C:\MEDIATHEQUE\photo.EPS"
why do you want -bgcolor?
With -keepcspace option i got black (or random color) stripes
Re: Help with CANVAS and RESIZE
Posted: Mon May 23, 2022 11:57 am
by xnview
could you send me the original file?
Re: Help with CANVAS and RESIZE
Posted: Mon May 23, 2022 1:35 pm
by bll06
xnview wrote: Mon May 23, 2022 11:57 am
could you send me the original file?
The original file
Re: Help with CANVAS and RESIZE
Posted: Mon May 23, 2022 2:16 pm
by xnview
ok, the original image is in CMYK, you would like to keep it in CMYK?
Re: Help with CANVAS and RESIZE
Posted: Tue May 24, 2022 12:12 pm
by bll06
xnview wrote: Mon May 23, 2022 2:16 pm
ok, the original image is in CMYK, you would like to keep it in CMYK?
Yes, I need to keep the originals colors
Re: Help with CANVAS and RESIZE
Posted: Mon May 30, 2022 9:56 am
by xnview
ok, i'll fix it....
Re: Help with CANVAS and RESIZE
Posted: Tue Oct 17, 2023 10:06 pm
by RENEDANSET
j'ai le même problème,
nconvert -ratio -rtype lanczos -rflag orient -resize 600 600 -canvas 600 600 center -bgcolor 255 255 255 "C:/PHOTOS/AL23512-PD01.jpg"
le fond est noir
Re: Help with CANVAS and RESIZE
Posted: Wed Oct 18, 2023 8:17 am
by xnview
RENEDANSET wrote: Tue Oct 17, 2023 10:06 pm
j'ai le même problème,
nconvert -ratio -rtype lanczos -rflag orient -resize 600 600 -canvas 600 600 center -bgcolor 255 255 255 "C:/PHOTOS/AL23512-PD01.jpg"
le fond est noir
il me faudrait votre image