News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Convert png to jpg

Started by Zediculous, November 16, 2016, 12:41:48 PM

Previous topic - Next topic

Zediculous

A newbie question.  What is the proper syntax to use if I want to convert png files to jpg keeping all metadata and the filename the same?

Phil Harvey

ExifTool deals with metadata, so you must use some other utility to convert the image from PNG to JPG.  After this, you can use ExifTool to copy as much of the metadata as possible:

exiftool -tagsfromfile source.png dest.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

Thanks for your quick response!

I really just want to change the capture date to match the filename.  I was able to complete the task successfully with my jpg's but not with my png's ... am I correct in assuming I need to convert to jpg's or does your magical tool work with png's as well and if so, what am I doing wrong.  I used the command:

exiftool "-alldates<$filename" DIR

My files have naming convention as follows:

YYYY-MM-DD-12345.png

thanks!




Phil Harvey

It works with PNG's too, and your command should set the PNG CreateDate and ModifyDate tags.  If you want to write other PNG date/time tags you'll have to copy FileName to them too.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

For some reason its not working.  I've included a screen capture of the old and new filenames after running your program.  It worked fine with the jpg's I had but with the png files it listed the date and time I converted them as the capture time .... what am I doing wrong?


Phil Harvey

I think that reading FAQ 24 will help you to understand what is going on.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

1)  I appreciate the support!  Your software is awesome and has saved me hours of manual entry time
2)  I read the FAQ and confirmed that the create date was indeed modified to the filename date
3)  When I import the image into Photoshop, it appears that it sorts using the dates windows explorer uses (date/time values stored in the filesystem).  I am assuming that's because Photoshop's algorithm uses the windows data rather than the true metadata.  How do I correct this? ie:  how do I get Photoshop to recognize the creation date set by your software.  Again I did not have this issue with the jpg files.  Just the png ones.

thanks again for dealing with my ignorance!

regards

Phil Harvey

In general, Photoshop support for PNG metadata is very poor, so I am not surprised it uses the filesystem FileModifyDate instead of the metadata for these files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

Is there a way to change the date / time values used by the filesystem using the filename?

Phil Harvey

Yes.  You set it just like any other date/time tag:  "-filemodifydate<filename"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

thank you!  Great software!  Excellent support!