Author Topic: Convert png to jpg  (Read 4308 times)

Zediculous

  • Newbie
  • *
  • Posts: 6
Convert png to jpg
« on: November 16, 2016, 12:41:48 PM »
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 Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17049
    • ExifTool Home Page
Re: Convert png to jpg
« Reply #1 on: November 16, 2016, 01:04:10 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

  • Newbie
  • *
  • Posts: 6
Re: Convert png to jpg
« Reply #2 on: November 17, 2016, 06:02:10 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17049
    • ExifTool Home Page
Re: Convert png to jpg
« Reply #3 on: November 17, 2016, 07:19:05 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

  • Newbie
  • *
  • Posts: 6
Re: Convert png to jpg
« Reply #4 on: November 17, 2016, 07:32:41 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17049
    • ExifTool Home Page
Re: Convert png to jpg
« Reply #5 on: November 17, 2016, 08:26:21 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

  • Newbie
  • *
  • Posts: 6
Re: Convert png to jpg
« Reply #6 on: November 17, 2016, 09:09:10 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17049
    • ExifTool Home Page
Re: Convert png to jpg
« Reply #7 on: November 17, 2016, 09:10:42 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

  • Newbie
  • *
  • Posts: 6
Re: Convert png to jpg
« Reply #8 on: November 17, 2016, 10:02:08 AM »
Is there a way to change the date / time values used by the filesystem using the filename?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17049
    • ExifTool Home Page
Re: Convert png to jpg
« Reply #9 on: November 17, 2016, 10:51:20 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zediculous

  • Newbie
  • *
  • Posts: 6
Re: Convert png to jpg
« Reply #10 on: November 17, 2016, 11:07:36 AM »
thank you!  Great software!  Excellent support!