files changing in some way

Started by sippa, April 10, 2016, 07:18:21 AM

Previous topic - Next topic

sippa

Hi, I'm a new user to this forum and ExifTool, so please forgive my ignorance.

I'm a photographer and was looking for help in my workflow and this tool seemed to fit the bill.

I ftp captioned images to various places and needed to change the 'caption' and 'headline' depending on where the file was going. I previously would do this using 'cut and paste' for each image, which can take some time.

So, ExifTool to the rescue. I was hoping to use a batch file on my windows 10 laptop to look for a specific character in the caption and discard everything after it. The same would apply to the Headline. All other IPTC data in the file is to be deleted as the second agency does not want my copyright information in it.

I have made the following .bat file to do this....


dir /B *.jpg > dir.txt
SETLOCAL EnableDelayedExpansion
for /F "tokens=*" %%i in (dir.txt) do (
REM Get caption and remove everything after the "~"
FOR /F "tokens=* USEBACKQ" %%F IN (`exiftool -v0 -s3 -Caption-Abstract %%i`) DO SET caption=%%F
for /F "tokens=1 delims=~" %%f in ("!caption!") do set new_caption=%%f
REM Get header and remove everything after the "~"
FOR /F "tokens=* USEBACKQ" %%e IN (`exiftool -v0 -s3 -Headline %%i`) DO SET header=%%e
for /F "tokens=1 delims=~" %%d in ("!header!") do set new_header=%%d
REM Remove ALL meta data
exiftool -overwrite_original_in_place -q -all= %%i
REM Set new meta data
exiftool -overwrite_original_in_place -q -Caption-Abstract="!new_caption!" -Headline="!new_header!" %%i
)




This seems to work just fine when I view the files on my laptop and when I ftp the files to my server, however, when I send the files to the photo libraries they are saying that there are 'processing' errors. They are blaming ExifTool, but I feel it might be a problem ate there end... I'm totally confused....

Could someone possibly give me some help/reassurance that the .bat file is OK and that the photos should not be changed, apart from the captions/headlines.


Phil Harvey

This should absolutely not result in any problems in the images, however your server may rely on EXIF or some other information which you have deleted.

But if I understand what you are doing, your entire batch file can be replaced by this exiftool command:

exiftool -all= "-caption-abstract<${caption-abstract;s/~.*//}" "-headline<${headline;s/~.*//}" -q -overwrite_original_in_place -ext 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 ($).

StarGeek

Quote from: Phil Harvey on April 10, 2016, 09:45:37 AM
...however your server may rely on EXIF or some other information which you have deleted.

This seems to be the mostly likely problem. If you want to just remove the copyright notice, you're probably better off just using -Rights= -Copyright= -CopyrightNotice= instead of -all=.  If you want remove more data, maybe -xmp:all= -iptc:all= but you probably want to exclude the EXIF group from removal. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

sippa

Many thanks Phil and stargeek for taking the time to reply. Yes I think they do rely on someting in the exif data.

I replaced the line which deletes all data with one that just replaces the 'caption' and 'headline'. They have now uploaded successfully, YAY.

I will try your one line solution Phil. Can I just create a .bat file with that line in it? Will it apply changes to all of the jpg files in the directory?

Thanks again guys

sippa

OK, just updated the script to Phils 1 liner. WOW what a speed improvement.

My script was taking @57sec for 38 jpgs. The one liner took ONLY 3.5secs.

Thank you so much for this. Great help from a great forum.

BTW I took out the -all=