NConvert jpg -> jpg how to reduce size?

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

Moderators: helmut, XnTriq, xnview

Post Reply
DeepKeeper

NConvert jpg -> jpg how to reduce size?

Post by DeepKeeper »

The problem is converting jpg image to jpg with fixed resulting max Wildth and max Height saving aspect ratio.

For example picture 250x200 should be converted to 100x80 and 200x250 to 80x100.

Can do it automatically using NConvert?
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: NConvert jpg -> jpg how to reduce size?

Post by xnview »

DeepKeeper wrote:The problem is converting jpg image to jpg with fixed resulting max Wildth and max Height saving aspect ratio.

For example picture 250x200 should be converted to 100x80 and 200x250 to 80x100.

Can do it automatically using NConvert?
You can use :

Code: Select all

-rflag orient
Pierre.
bishopdonmiguel
Posts: 3
Joined: Sun Jul 17, 2005 12:12 pm

Post by bishopdonmiguel »

You can use :
Code:
-rflag orient
I want to do exactly as DeepKeeper describes. I have source jpg's at 2272x1704 and 1704x2272. I'd like nconvert to intelligently resize to 640x480 or 480x640 based on the source orientation. Unfortunately, I haven't found a syntax that will do this.

I have tried...

nconvert. exe -out jpeg -ratio -rflag orient -resize 640 0 -o %.jpg *.jpg

...but all the output files are 640 wide with varying height (480 for the 2272x1704 files and 853 for the 1704x2272 files). It is possible for nconvert to correctly resize the various files a single command? Would you provide an example please?

Thank you.

p.s. great program :D
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

bishopdonmiguel wrote:I have tried...

nconvert. exe -out jpeg -ratio -rflag orient -resize 640 0 -o %.jpg *.jpg

...but all the output files are 640 wide with varying height (480 for the 2272x1704 files and 853 for the 1704x2272 files). It is possible for nconvert to correctly resize the various files a single command? Would you provide an example please?
Please try:
nconvert. exe -out jpeg -ratio -rflag orient -resize 640 480 -o %.jpg *.jpg
Pierre.
bishopdonmiguel
Posts: 3
Joined: Sun Jul 17, 2005 12:12 pm

Post by bishopdonmiguel »

Please try:
nconvert. exe -out jpeg -ratio -rflag orient -resize 640 480 -o %.jpg *.jpg
Interesting. I will try that. I left the 480 param as 0 because I may have different size source images in the future and I want the image to be 640 by "X" resolution while keeping the original ratio. What will happen if the source has width/height ratio not equal to 640x480? Will the 640 or 480 prevail? Or neither? Will the same value prevail for portrait and landscape orientations?

Thanks.
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

bishopdonmiguel wrote:
Please try:
nconvert. exe -out jpeg -ratio -rflag orient -resize 640 480 -o %.jpg *.jpg
Interesting. I will try that. I left the 480 param as 0 because I may have different size source images in the future and I want the image to be 640 by "X" resolution while keeping the original ratio. What will happen if the source has width/height ratio not equal to 640x480? Will the 640 or 480 prevail? Or neither? Will the same value prevail for portrait and landscape orientations?
The resizing will make sure that the specified limits are not exceeded but ratio will be kept.

You can try this out with sample pictures and XnView using Batch conversion of XnView: In the dialog "Batch convert" you use the button "Advanced operations" and specify the operations (resize, rotate, ...) you want. Then you perform the conversion. Please note that the convert dialog will not close. If you are happy with the result, you can use the "Export to nconvert script" and have a look at the script and use the interesting lines. Sure enough you should actually also try out your script using nconvert and some test images. nconvert may behave a bit differently or your script may have a bug, so you better use test images at first.
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

bishopdonmiguel wrote:
Please try:
nconvert. exe -out jpeg -ratio -rflag orient -resize 640 480 -o %.jpg *.jpg
Interesting. I will try that. I left the 480 param as 0 because I may have different size source images in the future and I want the image to be 640 by "X" resolution while keeping the original ratio. What will happen if the source has width/height ratio not equal to 640x480? Will the 640 or 480 prevail? Or neither? Will the same value prevail for portrait and landscape orientations?
You have -ratio so ratio will be kept
Pierre.
Post Reply