Get "Error: Not a valid PNG" when tagsfromfile json

Started by dle001, June 20, 2021, 12:14:56 PM

Previous topic - Next topic

dle001

Hi

I'm trying to transfer datas from 3,000.json files to 3,000 image files (Google Photo Takeout) by using exiftool with this command

exiftool.exe -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json D:\Program.portable\exiftool-12.27\Newfolder

After That, I got the Error massage.

Error: Not a valid PNG (looks more like a JPEG)

How to bypass/ignore or fix it ?

Thank you

StarGeek

The error tells you what the problem is.  It has a .PNG extension but the file is a jpeg and should have a .JPG extension.  Rename it.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dle001

Quote from: StarGeek on June 20, 2021, 12:17:22 PM
The error tells you what the problem is.  It has a .PNG extension but the file is a jpeg and should have a .JPG extension.  Rename it.

Oh I can not rename all of files bacuse there are 3,000 image files.

Do you have easy way to rename all ?

StarGeek

exiftool -ext png "-filename<%f.$fileTypeExtension" /path/to/files/

This will check all PNG files and rename them if they need to be renamed.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

MrSimmo

#4
Just a quick update - I found the above command failing under Linux. Changed it to:

exiftool -ext 'png' '-FileName<%f.$FileTypeExtension' [path]

and it worked

StarGeek

Yes, the fact that you need to put single quotes around anything with a dollar sign on Mac/Linux has been mentioned (*checks stats*) 23,486 times in these forums. Every time that Phil posts an answer. This is due to the differences between Windows CMD and Mac/Linux command lines.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype