Help with CANVAS and RESIZE
Moderators: XnTriq, helmut, xnview
-
- Posts: 1
- Joined: Fri Jun 18, 2021 10:34 am
Help with CANVAS and RESIZE
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.
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...
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.
-
- XnThusiast
- Posts: 4213
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Help with CANVAS and RESIZE
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:
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...
Code: Select all
-bgcolor red green blue: Background color (for rotate/canvas)
-bgcolor2 red green blue alpha: Background color (for rotate/canvas)
I'm not sure looking quickly whether that is your problem, but you might take a look at that...
-
- Posts: 5
- Joined: Wed May 18, 2022 9:27 am
- Location: Cannes - France
Re: Help with CANVAS and RESIZE
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
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
-
- XnThusiast
- Posts: 4213
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Help with CANVAS and RESIZE
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.
-
- Posts: 5
- Joined: Wed May 18, 2022 9:27 am
- Location: Cannes - France
-
- XnThusiast
- Posts: 4213
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Help with CANVAS and RESIZE
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.
-
- Author of XnView
- Posts: 45045
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Help with CANVAS and RESIZE
and if you use
why do you want -bgcolor?
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"
Pierre.
-
- Posts: 5
- Joined: Wed May 18, 2022 9:27 am
- Location: Cannes - France
Re: Help with CANVAS and RESIZE
With -keepcspace option i got black (or random color) stripesxnview wrote: ↑Thu May 19, 2022 11:07 am and if you usewhy do you want -bgcolor?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"
You do not have the required permissions to view the files attached to this post.
-
- Author of XnView
- Posts: 45045
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 5
- Joined: Wed May 18, 2022 9:27 am
- Location: Cannes - France
Re: Help with CANVAS and RESIZE
You do not have the required permissions to view the files attached to this post.
-
- Author of XnView
- Posts: 45045
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Help with CANVAS and RESIZE
ok, the original image is in CMYK, you would like to keep it in CMYK?
Pierre.
-
- Posts: 5
- Joined: Wed May 18, 2022 9:27 am
- Location: Cannes - France
-
- Author of XnView
- Posts: 45045
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 2
- Joined: Tue Oct 17, 2023 9:56 pm
Re: Help with CANVAS and RESIZE
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
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
-
- Author of XnView
- Posts: 45045
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Help with CANVAS and RESIZE
il me faudrait votre imageRENEDANSET 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
Pierre.