Washington Apple Pi

A Community of Apple iPad, iPhone and Mac Users

How To Protect Your Images By Embedding Copyright Notices Inside JPEG Files

By James Kelly

Washington Apple Pi Journal, reprint information

First of all JPEG stands for the Joint Photographic Experts Group. JPEG is an industry group that has created the JPEG image format standard. Refer to http://www.jpeg.org/ for more information.

The purpose of this article is to showcase two tools you might use for embedding your copyright notice inside the file format of JPEG files. I've chosen JPEG files since they are the most commonly used file format in digital cameras.

Digital Cameras embed several types of data inside the images you take such as camera manufacturer, the date the picture taken, aperture and shutter speed and focal length. These are called EXIF tags and are also called "metadata". Mac users that remember the resource forks in classic Mac files will also remember the term "metadata."

To quote the official EXIF site http://www.exif.org, “EXIF stands for Exchangeable Image File Format, and is a standard for storing interchange information in image files, especially those using JPEG compression. Most digital cameras now use the EXIF format.”

Let's first of all examine an open source tool called exiftags and examine one of my pictures, trees.jpg, to see what my camera has hidden inside this image.

sample photo

    1. Step 1. Download the file exiftags-0.98.tar.gz from http://johnst.org/sw/exiftags/ to your desktop. Stuffit should launch and decompress the file to a folder.
    2. Step 2. If you haven't done so already download and install the Apple Developer Tools. You will have to go to the Apple developer site and sign up for a free account in order to download the tools. If you purchased Panther, it should already be on one of the cds.
    3. Step 3. Launch /Applications/Utilities/Terminal
    4. Step 4. Type: cd Desktop
    5. Step 5. Type: cd exiftags-0.98
    6. Step 6. Type: make && sudo make install
    7. Step 7. Enter your password

You have installed two applications, exiftags and exifcom. The first, exiftags, will display your pictures EXIF tags; the second allows you to add EXIF comments where you will store your copyright notice. I suggest once you've completed Step 7 you type (in Terminal) “man exiftags” and “man exifcom” to read the online man pages for these applications.

To look at my picture's EXIF tags lets try just exiftags without any command options:

jamesk @ /Users/jamesk/Desktop@Xmac-->exiftags trees.jpg
Camera-Specific Properties:
Equipment Make: OLYMPUS OPTICAL CO.,LTD
Camera Model: C40Z,D40Z
Camera Software: QuickTime 6.4
Maximum Lens Aperture: f/4.8
Image-Specific Properties:
Image Orientation: Top, Left-Hand
Image Orientation: Top, Left-Hand
Horizontal Resolution: 72 dpi
Vertical Resolution: 72 dpi
Image Created: 2003:12:07 15:49:06
Exposure Time: 1/500 sec
F-Number: f/5.6
Exposure Program: Creative
ISO Speed Rating: 100
Exposure Bias: 0 EV
Metering Mode: Pattern
Light Source: Unknown
Flash: No Flash
Focal Length: 19.80 mm
Color Space Information: sRGB
Image Width: 2272
Image Height: 1704

Now let's try the command with the -v or "verbose" flag:

jamesk @ /Users/jamesk/Desktop@Xmac-->exiftags -v trees.jpg
Other Properties:
Resolution Unit: i
Chrominance Comp Positioning: Co-Sited
Exif IFD Pointer: 302
Compression Scheme: JPEG Compression (Thumbnail)
Horizontal Resolution: 72 dpi
Vertical Resolution: 72 dpi
Resolution Unit: i
Offset to JPEG SOI: 1504
Bytes of JPEG Data: 6855
Chrominance Comp Positioning: Centered
Exif Version: 2.20
Image Generated: 2002:08:08 20:14:41
Image Digitized: 2002:08:08 20:14:41
Meaning of Each Comp: Unknown
Image Compression Mode: 2
File Source: Unknown
Scene Type: Unknown

Boy that's alot of information!

Now lets add a "Comment" with my copyright notice:

exifcom -w "copyright James Kelly" trees.jpg

Now let's look at the tags again to see the new "Comment" field:

jamesk @ /Users/jamesk/Desktop@Xmac-->exiftags trees.jpg
Camera-Specific Properties:
Equipment Make: OLYMPUS OPTICAL CO.,LTD
Camera Model: C40Z,D40Z
Camera Software: QuickTime 6.4
Maximum Lens Aperture: f/4.8
Image-Specific Properties:
Image Orientation: Top, Left-Hand
Image Orientation: Top, Left-Hand
Horizontal Resolution: 72 dpi
Vertical Resolution: 72 dpi
Image Created: 2003:12:07 15:49:06
Exposure Time: 1/500 sec
F-Number: f/5.6
Exposure Program: Creative
ISO Speed Rating: 100
Exposure Bias: 0 EV
Metering Mode: Pattern
Light Source: Unknown
Flash: No Flash
Focal Length: 19.80 mm
Comment: copyright James Kelly
Color Space Information: sRGB
Image Width: 2272
Image Height: 1704

I've made the new copyright Comment bold just so you can see it clearly.

So why would I want to do this command line style? Because by doing it command line you can add a copyright notice to an entire folder of images in one shot: cd to the folder of images and do:

jamesk @ /Users/jamesk/Desktop/test@Xmac-->exifcom -w "copyright James Kelly" *
overwrite comment in jpeg.jpg? (y/n [n]) y
overwrite comment in jpeg5.jpg? (y/n [n]) y
overwrite comment in jpg1.jpg? (y/n [n]) y
overwrite comment in jpg2.jpg? (y/n [n]) y
overwrite comment in jpg3.jpg? (y/n [n]) y
overwrite comment in jpg4.jpg? (y/n [n]) y

Be sure to answer y each time it asks if you want to overwrite the comment field. Now lets look at the comment in file "trees copy 1.jpg" to see if copyright notice is as we wish:

jamesk @ /Users/jamesk/Desktop/test@Xmac-->exiftags "jpeg.jpg" | grep Comment
Comment: copyright James Kelly

Wuhu! It works!

Ok now let's look at the application "JPEG Comment". JPEG Comment embeds a comment inside the file but not in the EXIF tags as noted above.

You can find this application here:

http://www.win.ne.jp/~juan/misc/jpegcom/index.html
http://www.versiontracker.com

Let's open my trees.jpg file:

Drag the image over JPEG Comment's icon to open it:

JPEG comments window

Select Text Encoding "Western (Mac OS Roman), enter your comment in the comment box and click "Write comment". The comment you entered will only be visible if you reopen the image in "JPEG Comment". The previous application exiftags can't see it because the comment isn't in the EXIF tags but is embedded at the end of the file.

Now in case you were thinking that this was absolutely secure, I've reopened the file trees.jpg in a hexeditor to show you the new comment "copyright: Joe Blow"

View in hex editor

As you can see the determined image thief can find and modify your copyright notice you added using either exifcom or JPEG Comment, it just requires determination.

Wrapping up, Adobe Photoshop has the ability to add copyright notices using image watermarking which uses steganographic technology. I'll leave discussion of that to those more knowledgeable than I.