Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Embed copyright notices into JPEG images UNIX
Digital Cameras embed several types of data inside the images you take, including camera manufacturer, date the picture was taken, and aperture, shutter speed, and focal length settings. These are called EXIF tags and are also called "metadata." Here's how to take advantage of these tags to embed your own copyright notice.
  1. Download the file exiftags-0.98.tar.gz from the exiftags web page to your desktop. Stuffit should launch and decompress the file to a folder.

  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 (and they're large, at over 300mb). If you purchased Panther, it should already be on one of the CDs.

  3. Launch /Applications -> Utilities -> Terminal

  4. Enter the following commands:
     $ cd Desktop
     $ cd exiftags-0.98
     $ make && sudo make install
    
Enter your password when requested on the last step. You've now compiled the exiftags and exifcom programs. Read the rest of the hint to see how to use them to embed your copyright notice...

Let's look at my picture trees.jpg's EXIF tags using exiftags:
$ 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 lets add a "Comment" with my copyright notice. Type:
$ exifcom -w "copyright Joe Blow" trees.jpg
Now let's look at the tags again to see the new "Comment" field:
$ exiftags trees.jpg
Camera-Specific Properties:

Equipment Make: OLYMPUS OPTICAL CO.,LTD
...
...
Flash: No Flash
Focal Length: 19.80 mm
Comment: copyright Joe Blow
Color Space Information: sRGB
Image Width: 2272
Image Height: 1704
You can add your copyright tag to a folder full of images by doing:
$ cd /path/to/picture/directory
$ exifcom -fw "copyright Joe Blow" *
Those handy with AppleScript can create a folder actions script using this construct:
  do shell script "exifcom -fw "copyright Joe Blow" * && exiftags *"
Then attach the script to your picture folder. Now, whenever you add an image to the folder, you automagically tag it with your copyright notice! Check out this Apple tech note ... following it's lead, I came up with an AppleScript:
on adding folder items to this_folder after receiving these_items
	do shell script "exifcom -fw 'copyright Joe Blow' *"
end adding folder items to
Your mileage may vary, of course, but this worked for me...
    •    
  • Currently 2.20 / 5
  You rated: 1 / 5 (5 votes cast)
 
[22,678 views]  

Embed copyright notices into JPEG images | 18 comments | Create New Account
Click here to return to the 'Embed copyright notices into JPEG images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Embed copyright notices into JPEG images
Authored by: pcp_ip on Apr 14, '04 11:48:47AM

very nice... Now if i could only figure out how to also use an applescript folder action to watermark the actual image as well, I'd be set.



[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: Black on Apr 14, '04 01:07:37PM
You should look into imagemagick. ImageMagick is a collection of command line graphics manipulation tools. I only use it for simple convertions (scaling, switching formats, etc...), but I know that it can be used to compose multiple images so that you can add a watermark. If you aren't afraid of scripting, it wouldn't be too hard to AppleScript something up for a folder action. I personally have it installed via fink, but if you aren't a fink user, you can probably compile it from source.

[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: dotpuppy on Apr 14, '04 06:26:33PM

I suggest getting a copy from Mark Liyanage's excellent website. He often complies unix utilities into mac os x packages and consistently does an excellent job.

Imagemagick can be found here:

http://www.entropy.ch/software/macosx/welcome.html#imagemagick



[ Reply to This | # ]
watermarking with ImageMagick
Authored by: mzs on Apr 14, '04 01:51:54PM
You can use this tutorial on watermarking with ImageMagick to write the shell script that does what you want. Then you will want to make a do shell script ... AppleScript to attach to a folder action.

The thing is that JPEG is lossy so by doing the watermark with the convert (from ImageMagick) you will lose some quality. You may like to look into the droppatch for the Independant JPEG Group codebase. You can read more about droppatch, croppatch, and EXIFpatch here. If I recall correctly the Exifpatch is already included in the croppatch and droppatch candidate. The IJG homepage is here.

So what do I mean by the last paragraph? You might like to use jpegtran -crop ... to splice-out the portion you will watermark from your original image. Then you would do one big convert ... command to create the watermark. Finally you would use jpegtran -drop ... to add your watermark. If ImageMagick changed the sampling factors to 8x8 from 16x8 (or some other convolution like that) you would use export to BMP in the convert command and then use a cjpeg -sample HxV ... (cjpeg is part of the IJG codebase) before the 'drop' (but it is possible that convert may have an option for this).

Whew...

If by watermarking you meant something like changing DCT coefficients or a spread spectrum approach, there is some nice academic literature on this (the adaptive spread spectrum techniques are neat in particular) but except for some matlab files there really is nothing out there that I know of available. If you know of anything like this, I would love to hear about it though!

Oh, two more points. Do not use sips -s copyright 'Joe Blow' ... to add a copyright since sips will recompress the image and destroys your original! Also you might think that wrjpgcom -c 'copyright Joe Blow' ... might do the right thing, but EXIF is not a bunch of JPEG COM markers. But it might be a good idea to do the wrjpgcom anyway since less people know about the COM markers than the EXIF copyright property. So if someone stripped-out the EXIF copyright property (or worse changed it) but did not know about the copyright comment that would be beneficial to you if your copyright was infringed.

Really none of this is going to do anything to seriously protect your copyright though. If you use steg to 'hide' a copyright notice, then almost any trivial image manipulation (such as recompresion) will most likely remove that. The DCT and spread spectrum watermarking techniques could be easily identified with statisical analysis. Then the infringer could use the same tools to insert his own copyright notice. Changing the JPEG comments and EXIF properties is trivial. And of course anyone with PaintShop or GIMP can crop/mask/blur your watermark in the image itself. A very determined infringer could do all this. So if you really care, why not just register all of your images that you care about with the copyright office and skip all of the watermarking that degrades the image itself.

Spread spectrum or DCT coef watermarks cannot really be useful unless there is an impartial third party involved and some crypto hashes are used. But then all those watermarks can be replaced, the image can be cut-up into bits and reassembled with HTML to prevent there being enough bits of the watermark in a single part to identify, and placed behind logins so that spiders cannot see the infringing file easily, so what is the point really...

[ Reply to This | # ]

Embed copyright notices into JPEG images
Authored by: Crimson Napkin on Apr 14, '04 02:19:04PM

Use Photoshop (assuming you have it). Create an action to add a semitransparent image on top of your photo. Make that action batchable and batch alter folders full of images.

---
macosxhints.com is one reason PC users should switch to a Mac.



[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: Ortwin Zillgen on Apr 14, '04 06:32:06PM

use GraphicConverter for that



[ Reply to This | # ]
Also works with jhead
Authored by: mfuhrer on Apr 14, '04 01:03:53PM
Another command line utility that changes exif data and comment fields is jhead. To add a comment, use the following command:

jhead -cl "my comment here" picturename.jpg

jhead is available via Fink, although in order to use the -cl flag you'll need the latest version 2.1 (currently not in Fink, but a downloadable binary exists on the jhead webpage).

[ Reply to This | # ]
sips...if you have 10.3 or >
Authored by: Harry Fong on Apr 14, '04 01:12:07PM

there is something built into OS X 10.3 (or better) called sips. It does everything you could probably ever want to do to an image. You can also use the Image Events AppleScript abilities. Type sips -h for help on sips, or type sips -H for help on all the properties you can edit or modify with sips.



[ Reply to This | # ]
sips...if you have 10.3 or >
Authored by: foobar104 on Apr 14, '04 01:43:29PM

In particular, to do what you want to do here, do this:

sips -s copyright "Copyright 2004 whatever whatever" image.jpg



[ Reply to This | # ]
Do not use sips...
Authored by: mzs on Apr 14, '04 01:55:14PM
Read my post above to understand why. Basically the image is decoded/encoded and for JPEG this causes a loss in quality.

[ Reply to This | # ]
Do not use sips...
Authored by: Harry Fong on Apr 14, '04 08:02:17PM

Wow, I have very little experience with sips, I just got my first digi-cam and was reading up on diff. command line image features in OS X (Im a programmer and sys admin, I love to be able to script anything ;) ). I had no idea sips would cause a loss of quality. At first I found it hard to believe, but I wrote a simple ruby script to apply a different copyright to a specified image file 100 times. Indeed the end result was a file smaller in size, but my eye was not good enough to notice a huge quality loss. However, quality loss there was. Thank you for the heads up.



[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: john_dough on Apr 14, '04 02:56:02PM
All of which is useless once you bring the image into photoshop...

select all
copy
new
paste

no more copy right info.

[ Reply to This | # ]

Embed copyright notices into JPEG images
Authored by: guet on Apr 15, '04 04:30:35AM

err, I think it was for people who take images and want to add some info so that *honest* people (yes, there are some in the world) can find out where an image came from. Obviously it's not a method for protecting the files - that's a very difficult problem.



[ Reply to This | # ]
Graphic Converter
Authored by: jiga on Apr 15, '04 09:54:42AM
Instead of all this installation stuff, you could just use Graphic Converter and edit the metadata directly.

[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: CrankyMacGuy on Apr 15, '04 08:05:17PM

I'm getting nothing but errors. I distinctly remember installing the developer disk. I've got the "Developer" folder right there on my root drive, but all I see is:

exiftags.c:40:19: stdio.h: No such file or directory

and many many other errors since make couldn't find any of the other libraries as well. Any suggestions what went wrong on my install?

---
~Life...don't talk to me about life.



[ Reply to This | # ]
Embed copyright notices into JPEG images
Authored by: Harry Fong on Apr 15, '04 08:41:01PM

I'd just try to re-install the dev tools. If it can't find stdio.h, there is a problem. However, I can't say what specifically. My best guess is for some reason the folder /usr/include was removed...or the file /usr/include/stdio.h was removed. My guess if you say that lots of files couldn't be found is that the whole folder was removed. Easiest thing to do is just re-install the dev tools (they have come on a CD with every release of OS X, or you can download them for free from developer.apple.com)

---
"Ooooohhhhhh, they have the Internet on computers now?!" -- Homer Simpson



[ Reply to This | # ]
can't get folder actions to work
Authored by: macubergeek on Apr 18, '04 04:47:53PM

can't get this applescript folder actions to work...here's what I have:

[code]
on adding folder items to this_folder after receiving these_items
tell application "Finder"
repeat with i from 1 to the number of items in these_items
do shell script "/usr/local/bin/exifcom -fw 'copyright Joe Blow' *"
end repeat
end tell
end adding folder items to
[/code]



[ Reply to This | # ]
can't get folder actions to work
Authored by: macubergeek on Apr 19, '04 07:50:29AM

Ok here is a folder action that will work:
Copy and paste this into Applescript Editor and save it in ~/Library/scripts/Folder Action Scripts
Right click on the folder you want to attach it to, select enable folder actions and right click again and navigate to your new script and select attach folder action.

on adding folder items to this_folder
tell application "Finder"
set this_list to list folder this_folder without invisibles
set this_folder to this_folder as string
repeat with i from 1 to the count of this_list
do shell script "/usr/local/bin/exifcom -fw 'copyright Joe Blow' /path/to/your/folder*"
end repeat
end tell
end adding folder items to



[ Reply to This | # ]