Rename photos with EXIF

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

Moderators: XnTriq, xnview

Mambobuzzz
Posts: 1
Joined: Wed Apr 07, 2021 2:45 pm

Rename photos with EXIF

Post by Mambobuzzz »

Hi,

many thanks for the great software that I've gladly used over many years! :)

I'm trying now something quite easy, renaming photos with EXIF data. I've tried this:

nconvert.exe -o $EXIF:DateTaken["%F"] *.jpg

But nothing appends. Documentation didn't help. Can someone please help me?

Mambobuzzz
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rename photos with EXIF

Post by xnview »

%F is not recognize on Windows, please use $EXIF[%Y-%m-%d]
Pierre.
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

Hi there, I'm trying to use this code from a bath file in windows 10, NCONVERT v7.95:

.\NConvert\nconvert -o $EXIF:DateTaken[%%Y%%m%%d-%%H%%M%%S]_%% -keep_icc -ratio -rtype hanning -rflag decr -resize shortest 1500 -D -overwrite "..\*.png" "..\*.jpg" "..\*.jpeg"

the problems I have are:

1) the converted files are saved in the directory of the batch script, not in the upper directory ..\ where are the original files
2) when the original files are .png as EXIF info I have the filename
3) I want to separate the EXIF info from the filename with _ but I'm not able...

the original file names I have are:

IMG_3173.JPG
IMG_3174.JPG
IMG_3175.PNG
IMG_3177.PNG
IMG_3176.PNG

and the ouput file names are:

mIMG_3175d-IMG_3175HIMG_3175MIMG_3175S]_IMG_3175.png
mIMG_3176d-IMG_3176HIMG_3176MIMG_3176S]_IMG_3176.png
20211018-121005IMG_3173.jpg
mIMG_3177d-IMG_3177HIMG_3177MIMG_3177S]_IMG_3177.png
20211018-121430IMG_3174.jpg

help or suggestions will be appreciated!

best regards
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

well, for the problem 3) I found that I can scape the character with $_ but now don't save the .png files

Error: Can't create file (mIMG_3177d-IMG_3177HIMG_3177MIMG_3177S]C:\Users\noadmin\Desktop\Nueva carpeta\Nueva carpeta\-IMG_3177.png)
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rename photos with EXIF

Post by xnview »

you need to use

Code: Select all

-o ..\$EXIF:DateTaken[%%Y%%m%%d-%%H%%M%%S]_%%
2) when the original files are .png as EXIF info I have the filename
PNG files don't have EXIF
Pierre.
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

hello, many thanks for your response,

I need to scape $_ otherwise don't put the correct name on .png files.
.\NConvert\nconvert -o ..\$EXIF:DateTaken[%%Y%%m%%d-%%H%%M%%S]$_%% -keep_icc -ratio -rtype hanning -rflag decr -resize shortest 1500 -D -overwrite "..\*.png" "..\*.jpg" "..\*.jpeg"

so there is no way to extract the date taken from PNG files?
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rename photos with EXIF

Post by xnview »

tomv wrote: Tue Nov 02, 2021 8:28 pm so there is no way to extract the date taken from PNG files?
So you would like to extract EXIF date if present, else file date?
Pierre.
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

Hi, yes, that's right.
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

but file date would be the modification date, I guess, not the creation date right?
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rename photos with EXIF

Post by xnview »

Ok, i'll $DateModified
Pierre.
tomv
Posts: 6
Joined: Sat Oct 30, 2021 4:33 pm

Re: Rename photos with EXIF

Post by tomv »

Fine, many thanks!