Resize output not as expected

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

Moderators: XnTriq, helmut, xnview

Post Reply
vogoff
Posts: 1
Joined: Fri Mar 26, 2021 6:44 pm

Resize output not as expected

Post by vogoff »

Hi!
I copied the same png to the same folder with names 00z.png and 00zz.png. (I did that just for this example. The problem exist with all kinds of different files that I tried so far.)

nconvert -out jpeg -ratio -resize 1024 00z*.png
Conversion of 00zz.png into 00zz.jpg OK

00zz.jpg gets created, but nothing else. No error messages either. If there are more files in the folder (more precisely: matching the search parameters), then only the first gets missed. If there is only one file, the it will not be processed, because it's the first.

Interestingly if I type the command incorrectly (-ratio after resize, which makes -ratio not work - the result image will be stretched):

nconvert -out jpeg -resize 1024 -ratio 00z*.png
Conversion of 00z.png into 00z.jpg OK
Conversion of 00zz.png into 00zz.jpg OK

00z.jpg and 00zz.jpg both gets created, but they are stretched, because -ratio wasn't applied.

I only tried it out on a windows xp 5.1.26 with Nconvert v7.39 (if Readme.txt is correct about that)

My guess is: When the internal task list gets created after entering the command, the first file somehow is excluded from it. I will try it on something newer.

Any help is appreciated.
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: nconvert First file missing, first file unnoticed, fail to see first file

Post by cday »

vogoff wrote: Fri Mar 26, 2021 8:54 pm I copied the same png to the same folder with names 00z.png and 00zz.png. (I did that just for this example. The problem exist with all kinds of different files that I tried so far.)

Code: Select all

nconvert -out jpeg -ratio -resize 1024 00z*.png
Conversion of 00zz.png into 00zz.jpg OK
00zz.jpg gets created, but nothing else. No error messages either. If there are more files in the folder (more precisely: matching the search parameters), then only the first gets missed. If there is only one file, the it will not be processed, because it's the first.
Don't you need a second parameter after -resize?

Code: Select all

-resize w h   : Scale width-height
   w h can be percent (ex: -resize 100% 200%)
-resize fill w h      : Scale by filling the box wxh
-resize longest size  : Scale longest side
-resize shortest size : Scale shortest side
-resize dpi value     : Scale to DPI
You think -ratio obviates the need for the width parameter, that does seem logical but isn't too clear from the help file, but if it doesn't produce the expected output there could possibly be a bug. I would test using the latest NConvert version in case a bug has been reported and fixed.

You wish to resize all images to a width of 1024px while maintaining the existing aspect ratio, which presumably differs for different images?

Edit:

Assuming -ratio is intended for use with -resize, I can see how it might be used to resize to a width while maintaining the image aspect ratio, but not how it could be used to resize to a height maintaining the aspect ratio.

And the order -resize -ratio is probably correct, to output a multi-page PDF the sequence -out pdf -multi must be used.
Post Reply