2 ExifTool scripts for jpeg & tiff (my donation to all you)

Started by Artem Ivanovsky, January 21, 2024, 03:35:35 AM

Previous topic - Next topic

Artem Ivanovsky

I created these 2 scripts somewhere before 2016, have not used them since 2017. They are to remove absolutely all metadata from jpeg and tiff files but preserve a few tags I need. Hope they still work fine with current ExifTool. Perhaps the Phil (Harvey) will comment the scripts have flaws or are excellent  :P .

~~~~~~~~~~~~~~~~~~~~~~~~FOR_JPEG~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#FULL_PATH_TO_EXIFTOOL.EXE -@ THIS_FILE DIRECTORY_PATH
#
-r
-overwrite_original

-all=
-tagsfromfile
@
-ICC_Profile
-IFD0:Make
-IFD0:Model
-ExifIFD:ExposureTime
-ExifIFD:FNumber
-ExifIFD:ISO
-ExifIFD:ExifVersion
-ExifIFD:DateTimeOriginal
-ExifIFD:CreateDate
-ExifIFD:ShutterSpeedValue
-ExifIFD:ApertureValue
-ExifIFD:ExposureCompensation
-ExifIFD:Flash
-ExifIFD:FocalLength

#comment the following line if "ExifIFD:ExifVersion" is not equal to "0230"
-ExifIFD:LensModel=Canon EF 24-70mm f/2.8L II USM

-IFD0:XResolution=
-IFD0:YResolution=
-IFD0:ResolutionUnit=
-IFD0:YCbCrPositioning=
-ExifIFD:ComponentsConfiguration=
-ExifIFD:FlashpixVersion=
-ExifIFD:ColorSpace=
~~~~~~~~~~~~~~~~~~~~~~~~FOR_JPEG~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~FOR_TIFF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#FULL_PATH_TO_EXIFTOOL.EXE -@ THIS_FILE DIRECTORY_PATH
#
-r
-overwrite_original

-all=
-tagsfromfile
@
-ICC_Profile
-ExifIFD:ExposureTime
-ExifIFD:FNumber
-ExifIFD:ISO
-ExifIFD:ExifVersion
-ExifIFD:DateTimeOriginal
-ExifIFD:CreateDate
-ExifIFD:ShutterSpeedValue
-ExifIFD:ApertureValue
-ExifIFD:ExposureCompensation
-ExifIFD:Flash
-ExifIFD:FocalLength

#comment the following line if "ExifIFD:ExifVersion" is not equal to "0230"
-ExifIFD:LensModel=Canon EF 24-70mm f/2.8L II USM

-IFD0:XResolution=
-IFD0:YResolution=
-IFD0:ResolutionUnit=
-IFD0:YCbCrPositioning=
-ExifIFD:ComponentsConfiguration=
-ExifIFD:FlashpixVersion=
-ExifIFD:ColorSpace=

-IFD0:Software=
-IFD0:Artist=
-IFD0:ModifyDate=
-IFD0:Orientation=
-IFD0:SubfileType=
-IFD0:PlanarConfiguration=

#
# Required (by the TIFF 6.0 Specification) Fields for RGB TIFF-Images
#
# TagName                    Decimal  Hex
#
# ImageWidth                256      100
# ImageLength                257      101
# BitsPerSample              258      102
# Compression                259      103
# PhotometricInterpretation  262      106
# StripOffsets              273      111
# SamplesPerPixel            277      115
# RowsPerStrip              278      116
# StripByteCounts            279      117
# XResolution                282      11A
# YResolution                283      11B
# ResolutionUnit            296      128
#
~~~~~~~~~~~~~~~~~~~~~~~~FOR_TIFF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PS: I don't remember the story about adding "-ExifIFD:LensModel=Canon EF 24-70mm f/2.8L II USM", sorry  :(

Phil Harvey

These should all work the same with the current version of ExifTool.

It looks like you are avoiding creation of the mandatory EXIF tags.  As of ExifTool 12.71 can simplify this by adding -api nomandatory to the command instead of removing these tags manually.

- 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 ($).

banana123

Quote from: Phil Harvey on January 21, 2024, 07:11:44 AMThese should all work the same with the current version of ExifTool.

It looks like you are avoiding creation of the mandatory EXIF tags.  As of ExifTool 12.71 can simplify this by adding -api nomandatory to the command instead of removing these tags manually.

- Phil

can it be done with pyexiftool?

StarGeek

"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