We are running an online-press media-library. On this site many brands are uploading images and track press users download and views per image. But some brand now want to add unique code in image so they can track their own images.

We tried some steganography tools:

  1. http://www.outguess.org/info.php (support JPG)
  2. http://www.imagemagick.org/Usage/transform/#stegano (support PNG)

Both works fine, but issue is that secure code disappeared after image resize or crop.

Simple way would be watermark, but we don't want to disturb images, because images are being used in press printing.

Is there any way to put secure code in JPG format image and track that code after resize or cropping of that image?


Our brands want to publish them as web image(light version), so press users could use images on blog and forums.

We will target press blog / forum site from crawler engine(~4500 blogs) and check if our image exist on these blogs.

3 Answers 3


You can add information to JPEG images in two ways:

  • you add information out of any image data, that is to say the JPEG headers
  • you add information in the image data, that is to say you modify the image

The first technique can be easily bypassed by simply removing the relevant data from the header.

The second technique can be broken down into:

  • Watermarking
  • Steganography

Steganography is used when you want to distribute information in images and want to remain as stealth as possible. You don't say you are putting information into the images and you try by all mean to minimise your impact on the image statistics.

Watermarking is used mostly for DRM purposes, you want to put information in the image and ensure it stays when modifications are made to this image (it is called a robust watermark). Robustness usually comes at the price of image alteration (we can say degradation here), there is no actual way of achieving a robust watermarking without "disturbing" the image as you say. There are many, many techniques of watermarking (which are off-topic for this question) with different type of robustness (cropping and resizing included) with different impact on quality. You should ask google scholar about that.

You'd probably better have two copies of the image, one for online display (with watermark) and one for printing (without watermark).

Edit: since you're not convinced yet, here is some link to relevant articles:

they should give you a good overview of the state of watermarking and its properties and possible attacks on it.

For further inquiry see at : https://scholar.google.com/

  • thanks for suggestion, watermark and original image option would be great, but we are not charging from press users, but brands are paying to us publish them images on our site, please see update question why we need Steganography and tracking of images.
    – Girish
    Commented Mar 27, 2015 at 4:57
  • I'm afraid you don't need steganography. You need digital right management and so you need a watermark robust to cropping and resizing as well as the property of being as invisible as possible. I've edited the answer to add resources.
    – M'vy
    Commented Mar 27, 2015 at 8:24

You might get good mileage out of merely adding this information as JPEG EXIF data, which will survive most modern image manipulations ... but is easily stripped out by somebody wanting to remove it. (A downside: PNG, GIF, and JPEG 2000 do not support EXIF. See my update below for XMP, which doesn't have that issue.)

Just to reiterate, EXIF data is rather well organized, easily viewed, and easy to remove (or modify), so it is not a security solution, but I don't think you'll find a viable security solution without watermarking the image.

If you don't want people to see the contents, encrypt it or use a code the requires looking up in your database. Then all somebody can do is remove it or modify it (which will destroy it).

Of course, if a database is on the table, you might be able to save a 32x32 pixel grayscale version of the image and use that as a hash (you'd be surprised at how few collisions you get). This will survive resizing and minor color correction, but it will not survive aggressive cropping or other manipulations.

EXIF and the db are not mutually exclusive; you could do both.

Update: I wrote this about EXIF, which is decently well understood and supported, but only supports JPEG. You could consider XMP, which supports pretty much all image types (and beyond, e.g. PDF and MP3) instead. I'm not as sure about its ability to survive edits made by editors that may not support it, but it looks pretty supported.

The XMP Wikipedia article doesn't mention ImageMagick support, and a quick web search reveals that ImageMagick probably supports XMP data; you'll want to verify that before deploying. I'd advise against XMP if edits from ImageMagick end up removing it. (ImageMagick is extremely common in web apps and shell scripts.)

  • i thought about meta data and exif data, but it's is not secure, anyone can remove easily, is XMP data secure?, i didn't try yet.
    – Girish
    Commented Mar 27, 2015 at 5:00
  • 1
    No, XMP data is merely more compatible. You are right, it can be removed (but if it's signed or encrypted, it can't be tampered with). You won't find anything that meets your needs without distorting the image (e.g. a watermark). The best I think of for your needs is the 32x32 grayscale "hash" plus the XMP data, though XMP can be removed and then you'd have to defend the "hash" (consider putting the hash in a 3rd-party repo that timestamps it for "proof" of ~ownership).
    – Adam Katz
    Commented Mar 27, 2015 at 17:45
  • Thanks man.. I will do more research on xmp data... It's looking useful.
    – Girish
    Commented Mar 29, 2015 at 13:42

Your're probably dealing with two different causes for loosing the hidden data:

  • Resize: this will operation will use an image scaling algorithm to create a new scaled version of the image, all pixel data (including your hidden data) will be lost.
  • Crop: some of the hidden data may be stored in the areas removed by the crop, then typically upon saving the cropped image a fresh pass of jpeg compression will be applied which will also destroy the hidden data.

I'm pretty sure that image owners such as Getty use complicated algorithms to decide if a given image is a match to an image in their library. Without the use of watermarking (something visible on the image) I can't think of another option I'm afraid (well none which wouldn't be easy to remove anyway).

Hope this helps!

  • Feedback on the reason for the downvote would be greatly appreciated, what can I do to improve my answer? It's based on experience with a project from quite a while ago, but reading what I've put a second time I'm still reasonably happy with the gist of it. Commented Mar 27, 2015 at 8:35
  • (I'm not the down vote) Robust watermarks that use redundant storage and self-scaling features exist. There are even some demonstrated that survive distortions, color adjustments, and such. Feature extraction can find similar images without the aid of watermarks, but if a watermark exists it can confirm the match.
    – RBerteig
    Commented Mar 27, 2015 at 20:25
  • Thanks for the comment and the extra information on watermarking @RBerteig. A feature matching algorithm sounds like the thing for the job, since Girish states that watermarking is not an option for him. Still leaves me wondering what earned me the down vote though, If anyone can see anything I've said which is inaccurate I'd be grateful for further comments. Commented Mar 28, 2015 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .