You are not logged in.
I occasionally need to delete metadata from JPEG photos and wrote an AppleScript for this purpose. The script uses the free ExifTool command-line utility, which can be found at:
https://exiftool.org
The operation of the script is described as follows:
* The script works on a file (or files) selected in a Finder window and creates a new file in the same folder without the specified metadata.
* Entering the word all then selecting the Tag button will remove all deletable metadata except the orientation tag.
* Entering all or a portion of the name of a tag then selecting the corresponding button will remove all matching tags. Some tags cannot be deleted, and some tags can only be removed as part of a group. With a large number of files, this option can be slow.
* Entering the full name of a group (e.g. exif, gps, and jfif) then selecting the corresponding button will remove the group and the deletable tags it contains. Some groups cannot be removed, in which case the script will notify the user.
* The output file name consists of the letters "EE"; the letter T for tag or G for group; the text entered by the user in the dialog; and finally the original file name.
Repeated saves of a JPEG file can degrade image quality but FAQ 13 on the ExifTool site reports:
ExifTool does not modify the image data itself, so editing a file with ExifTool is "lossless" as far as the image is concerned
The following is a listing of tags recognized by ExifTool:
https://exiftool.org/TagNames/
Applescript:
set exifUtil to "/usr/local/bin/exiftool"
tell application "Finder" to set sourceFiles to selection as alias list
if sourceFiles = {} then errorDialog("File not selected.")
repeat with sourceFile in sourceFiles
if sourceFile as text does not end with ".jpg" then errorDialog("Selected file may not be a JPEG file.")
end repeat
display dialog "Enter metadata to delete:" buttons {"Cancel", "Group", "Tag"} cancel button 1 default button 3 default answer "All" with title "Exif Edit" with icon note
set {dialogButton, dialogText} to {button returned, text returned} of result
if dialogText = "" then
errorDialog("Metadata not entered.")
else
set filePrefix to "EE (" & text 1 of dialogButton & space & dialogText & ") "
end if
set targetFiles to {}
set text item delimiters to "/"
repeat with sourceFile in sourceFiles
set sourceFile to POSIX path of sourceFile
set targetFile to (text 1 thru text item -2 of sourceFile) & "/" & filePrefix & (text item -1 of sourceFile)
set end of targetFiles to (quoted form of targetFile) & space
do shell script "cp " & quoted form of sourceFile & space & quoted form of targetFile
end repeat
set text item delimiters to ""
try
if dialogText = "All" then
do shell script exifUtil & " -overwrite_original -all= -tagsFromFile @ -orientation " & targetFiles
else if dialogButton = "Tag" then
do shell script exifUtil & " -overwrite_original \"-*" & dialogText & "*=\" " & targetFiles
else if dialogButton = "Group" then
do shell script exifUtil & " -overwrite_original -" & dialogText & ":all= " & targetFiles
end if
on error errorText
do shell script "rm -f " & targetFiles
display alert "ExifTool reported the following error:" message errorText as critical
end try
on errorDialog(errorText)
display dialog errorText buttons "OK" cancel button 1 default button 1 with title "Exif Edit" with icon stop
end errorDialog
Last edited by peavine (2020-05-27 10:06:39 am)
2018 Mac mini - macOS Catalina
Offline