Messing with EXIF/IPTC metadata
I've been long searching for ways of erasing/editing file metatags (EXIF, IPTC, etc) without restrictions.
Many programs/software have ways of doing it, but most don't allow to do it freely.
I mean, they might have comercial restrictions, but when for instance adobe tools say that a tag that says the file has been edited/created in Photoshop is a not "deletable" one... they are lying.
Every metatag is editable/deletable and the image itself can be rendered without any metatag info of this type. Of course, if for instance there's no color space metatag info the pixels might be rendered somehow different than the original. But that is only a context question, the pixels are there.
How did I come to this now?
I have a new camera! Yeeeaaahhh! Yes, finally I have a modern new, and hopefully great, Pentax k-5 (I'm planning another blog entry on it when I have enought pics to ilustrate ;) ). But one downfall of it is that is embeds in image files a ton of extra info. Like at least 40Kb but usually more, much more, for each file!
If you run the file through Lightroom you can then minimize metadata when exporting, but one interesting thing I discovered is that this camera can deliver jpegs good enough to upload directly to agencies (might take some tweekening in camera settings, and some extra care when shooting, but it's possible) either by shooting jpegs directly or by processing them from RAWs in the camera!
Enough chit chat.
I came across a little tool called Exiftool (http://www.sno.phy.queensu.ca/~phil/exiftool/) completly free and can do the trick. In fact it can do pretty much any exif/iptc trick you might think of.
But it is a command line tool, not that much userfriendly, I would say userenemy enough to send many looking for other options.
But not being the first time I was looking for this I decided to read those lines and check those examples a litle more in detail.
But fortunately you can use .bat files! Just in case you don't remember or don't know what .bat files are, they are "script" executables that can call any other executable and commands, MS-DOS like!
This way you can create as many bats as you want with as many commands as you want and keep just one exiftool executable. And you still can drag and drop files into those bat files. I'll show you some simple examples.
Now, what do I need to erase/change in EXIF info?
If I want to completetly strip all EXIF info from files I would execute: exiftool -all= jpeg_file.jpg
or create a bat file with this single line:
exiftool -all= %1
%1 takes the name of the file you drop on the bat file, or the first argument you pass to the bat file if calling it from command line.
I usually don't want to do that, but this is to ilustrate my first lines. And I was able to reduce filesize by some 50Kb to 100Kb.
The main syntax to use exiftool is: exiftool -:=
To delete a field keep the value blank after the equal sign.
What I do want to do is:
- remove manufacturer notes
- remove printing information
- remove thumbnail binary code
- set colorspace (my camera is set to Adobe RGB but EXIF keeps saying "uncalibrated" and after removing manufaturer notes there's no other source for that info)
- set image orientation to 0
To remove manufacturer notes: the EXIF group name for manufacturer notes in my camera is MakerNotes (might be different for other brands), the parameters are: -MakerNotes:all=
For printing information: -PrintIM:all=
For thumbnail binary info: -Composite:ThumbnailImage=
To set color space do Adobe RGB: -Exif:ColorSpace=A (this took some guessing! those values are not always obvious neither are their meanings)
To set image orientation to 0
If you don't know the Group Names you can use exiftool to list them with this command: exiftool -groupnames
The orientation thing explanation:
Image bytes are always created/saved as horizontal and then EXIF can add the info about camera orientation so that software can know how to rotate the pixel to show the way the picture was made.
But if software, specially older software, is not aware of it, will always use the image bytes orientation. I use a 1998 version of ACDSee for fast view!!
You can do a lossless rotation of the image, older software will show it ok, but EXIF info is still there and newer software will be wrong this time!
Same can happen with sites that don't read all EXIF info so you might endup uploading a wrongly oriented image!
So I set rotation to 0
I now have two bat files:
exiftool -MakerNotes:all= -PrintIM:all= -Composite:ThumbnailImage= -Exif:Orientation=h %1
exiftool -Exif:ColorSpace=A %1
There, hope this helps you...