Save image under a different name

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

Moderators: XnTriq, xnview

Post Reply
Zuldek
Posts: 12
Joined: Fri Jul 05, 2019 1:24 pm

Save image under a different name

Post by Zuldek » Fri Jul 05, 2019 1:28 pm

Code: Select all

nconvert -ratio -resize 325 -overwrite output.jpeg
I compress the image in width in proportion. How to save the image under a different name?

cday
XnThusiast
Posts: 2155
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Save image under a different name

Post by cday » Fri Jul 05, 2019 1:59 pm

Zuldek wrote:
Fri Jul 05, 2019 1:28 pm

I compress the image in width in proportion. How to save the image under a different name?

Code: Select all

-o filename       : Output filename
              Use # to specify position of numeric enumerator
              Use % to specify source filename
              Use $ to specify full source pathname
              Use $$ to specify source folder name
              Use $EXIF:DateModified[date format] to specify EXIF date modified
              Use $EXIF:DateTaken[date format] to specify EXIF date taken
									Date format: Please check documentation of strftime
          -out format       : Output format name

You have created a copy of the help file?

Zuldek
Posts: 12
Joined: Fri Jul 05, 2019 1:24 pm

Re: Save image under a different name

Post by Zuldek » Fri Jul 05, 2019 2:31 pm

Code: Select all

** NCONVERT v7.25 (c) 1991-2019 Pierre-E Gougelet (Jan 15 2019/12:05:55) **
        Version for Windows Xp/Vista/7 x64  (All rights reserved)
** This is freeware software (for non-commercial use)


output.jpeg : Success
    Format               : JPEG TrueColor (v1.2)
    Name                 : jpeg
    Compression          : JPEG
    Width                : 1280
    Height               : 720
    Components per pixel : 3
    Bits per component   : 8
    Depth                : 24
    # colors             : 16777216
    Color model          : RGB
    Bytes Per Plane      : 3840
    Orientation          : Top Left
    Xdpi                 : Not set
    Ydpi                 : Not set
    Page(s)              : 1
    Comment              : Lavc57.107.100
New to bat programming, tell me how to get the width

Code: Select all

    Width                : 1280

Code: Select all

for /f  "tokens=1* delims=:" %%a in ('nconvert -info output.jpeg ^|find "[11]"') do (
	echo  %%a
    echo %%b
)
I tried a lot of options, nothing comes out. I don't know what to do

cday
XnThusiast
Posts: 2155
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Save image under a different name

Post by cday » Fri Jul 05, 2019 3:02 pm

Zuldek wrote:
Fri Jul 05, 2019 2:31 pm
I tried a lot of options, nothing comes out. I don't know what to do
I don't know either, and it unlikely from past experience that anyone else will post a solution... :(

It is possible to write the image info to a text file, so possibly there is a way to parse that file to place a specific value into a variable that can then be used for further processing, for example for comparison with a specified value. That is a need I have sometimes identified myself.

I should make clear that my knowledge is limited to NConvert, plus some limited cmd.exe ['DOS'] which I have used to create batch files .bat. I answer NConvert posts because no-one else does, and from the code you posted above you have a deeper knowledge than I do. You could try requesting help on one or two of the general programming forums, and if you obtain any useful information please be sure to send me a link!

I may, however, start a new thread asking directly about extracting image information into a variable, in the hope that Pierre may respond. :?:

Edit:

I think ImageMagick may possibly provide a possible solution...

Zuldek
Posts: 12
Joined: Fri Jul 05, 2019 1:24 pm

Re: Save image under a different name

Post by Zuldek » Fri Jul 05, 2019 5:47 pm

Code: Select all

nconvert -ratio -resize shortest 180 -o output.jpg -out output222222.jpg
Cannot change the name of the convection image when saving

cday
XnThusiast
Posts: 2155
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Save image under a different name

Post by cday » Fri Jul 05, 2019 5:52 pm

Zuldek wrote:
Fri Jul 05, 2019 5:47 pm

Code: Select all

nconvert -ratio -resize shortest 180 -o output.jpg -out output222222.jpg
Cannot change the name of the convection image when saving

Code: Select all

-out format       : Output format name
I think, looking quickly, that you need to add the format.

Zuldek
Posts: 12
Joined: Fri Jul 05, 2019 1:24 pm

Re: Save image under a different name

Post by Zuldek » Fri Jul 05, 2019 6:20 pm

Code: Select all

nconvert -ratio -resize shortest 180 -o output.jpg -out format output222222.jpg
I tried it and it does not come out (((

cday
XnThusiast
Posts: 2155
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Save image under a different name

Post by cday » Fri Jul 05, 2019 7:13 pm

Zuldek wrote:
Fri Jul 05, 2019 6:20 pm

Code: Select all

nconvert -ratio -resize shortest 180 -o output.jpg -out format output222222.jpg
I tried it and it does not come out (((

You need to replace 'format' with the actual format, JPEG, I think it should work then, but I can't check it conveniently on my Linux laptop...

Post Reply