JPEG canaries: exposing on-the-fly recompression

Many photo-sharing websites decompress and compress uploaded images, to enforce particular compression parameters. This recompression degrades quality. Some web proxies can also recompress images/videos, to give the impression of a faster connection.

In Towards copy-evident JPEG images (with Markus Kuhn, in Lecture Notes in Informatics), we present an algorithm for imperceptibly marking JPEG images so that the recompressed copies show a clearly-visible warning message. (Full page demonstration.)

Original image:

Original image

After recompression:

The image after recompression, with a visible warning message

(If you can’t see the message in the recompressed image, make sure your browser is rendering the images without scaling or filtering.)

Richard Clayton originally suggested the idea of trying to create an image which would show a warning when viewed via a recompressing proxy server. Here is a real-world demonstration using the Google WAP proxy.

Our marking technique is inspired by physical security printing, used to produce documents such as banknotes, tickets, academic transcripts and cheques. Photocopied versions will display a warning (e.g. ‘VOID’) or contain obvious distortions, as duplication turns imperceptible high-frequency patterns into more noticeable low-frequency signals.

Our algorithm works by adding a high-frequency pattern to the image with an amplitude carefully selected to cause maximum quantization error on recompression at a chosen target JPEG quality factor. The amplitude is modulated with a covert warning message, so that foreground message blocks experience maximum quantization error in the opposite direction to background message blocks. While the message is invisible in the marked original image, it becomes visible due to clipping in a recompressed copy.

The challenge remains to extend our approach to mark video data, where rate control and adaptive quantization make the copied document’s properties less predictable. The result would be a digital video that would be severely degraded by recompression to a lower quality, making the algorithm useful for digital content protection.

30 thoughts on “JPEG canaries: exposing on-the-fly recompression

  1. Depending on where I position it vertically on the screen, the marking in the ORIGINAL image varies from barely perceptible to somewhat more perceptible. Never totally. (No browser scaling or filtering involved). This happens in a cycle as it moves vertically.

    I’m guessing it’s some kind of LCD-related effect.

  2. This is very impressive. I would be interested to see how it performs with a full colour image having lots of detail.

    @Ciaran – don’t see that hear, using a mid-range LCD monitor and trying a variety of positions and scaling in my browser.

  3. @Ciaran – Could it be that your graphics adapter does not output the native resolution of your display and the display electronics therefore rescales it? Compare the resolution detected by your monitor (displayed in its on-screen menu) with what the data sheet claims to be the pixel resolution of your monitor.

    Also, in case your display is connected via an analog cable (15-pin VGA connector), your display has to guess and reconstruct the pixel clock frequency, and might have gotten it slightly wrong. This will show up as a Moiré pattern with our high-amplitude dither patterns. Your monitor will have a menu to manually fine-tune the pixel-clock PLL, ideally using a suitable test chart.

    Making these adjustments should noticeable improve the sharpness of your display.

  4. It would be very interesting to see this extended to a colour image and uploaded to sites such as flickr to see if original really is original.

  5. At native resolution on an LCD, with a digital signal, I can faintly see something in the non-recompressed. I doubt I could tell what it says if I didn’t already know, but it doesn’t look quite uniform. It isn’t at all as clear as it looks looks when recompressed. it’s more like one of those hidden-picture illusions.

    http://www.moillusions.com/2010/03/black-or-white-portrait.html

    Of course, some LCD panels don’t really quite show true 24-bit and do funny things to compensate, that might be all that’s going on.

    http://en.wikipedia.org/wiki/Color_depth#LCD_displays

  6. This reminds me of the old Video tricks used to stop “pay-4-view” content being recorded onto video tape, whereby artifacts were deleberatly encoraged to produce “beat notes” with the rescaled colour burst frequency of the video recorder.

    Without digging out the tools to check (it’s easier to ask) I am guessing that the difference in forground and background signals could be detected by a suitable frequency or sequency analysis unless additional steps are taken?

  7. Clive,

    If you look at the image before recompression, all blocks have the same average intensity, but the amplitude of the checkerboard pattern is slightly different in foreground blocks. It is possible to detect this by comparing the magnitude of the highest frequency component in different blocks.

    The trick of the algorithm is to choose a pair of amplitudes that lie either side of a quantization boundary, so that foreground and background blocks experience maximum quantization error in opposite directions during recompression. We make sure that one of the amplitudes causes clipping, which lowers the perceived brightness of its blocks, causing a low-frequency discrepancy.

    Andrew

  8. Doesn’t work for me, no doubt the remarks about pixel clock &c &c all apply, but I’m not about to start mucking about with all that stuff and I suspect the average user wouldn’t either.

  9. I can also see the ‘VOID’ in the original image. I’m on a laptop, using the built-in display.

  10. Very interesting. Interestingly, when I tried to reproduce the results in copy-google-recomp.jpg using ImageMagick’s convert, results varied quite a lot, depending on the quality level. I used a short script like this:

    for i in `seq 0 90` ; do convert copy-google.jpg -quality $i compressed$i.jpg ; done

    Above a quality level of 70 or so, the VOID pattern varied between only barely recognizable, and not at all. It seems to be most visible at a quality level of 60. At really low qualities, it tends to be either very visible, or not at all.

  11. Intersting.

    More-so as I’m currently engaged in a project which does re-compress JPGs on the fly for remote reception on slow, expensive links. (which still exist, sadly) So I think there’s still some justification to carry it out (and on small screens which is what my target is, it’s much less noticable anyway).

    I get a regular pattern of small squares when I feed the sample background through my compressing proxy 🙂

    However on big sites where you pay to host images, or they’re advert supported… Shady practice IMO…

  12. If you can see the word VOID even in the original image on your screen, then I suspect that your display is configured into a 16 bit/pixel video mode, rather than 24 bit/pixel. And your display software simply rounds each 8-bit color channel value to the nearest 5 or 6 bit value, rather than using some dither or other error diffusion algorithm. Our marking technique sometimes also exposes other forms of image tampering than just JPEG recompression.

    Users of 24-bit display modes can simulate this effect by replacing in the image each byte value x with (x+2) & 0xfc.

    In Matlab:
    imshow(bitand(imread(‘http://www.lightbluetouchpaper.org/wp-content/uploads/2011/02/copy-google.jpg’)+2,252));

  13. Is there a way to detect if an image (e.g. JPEG) has been recompressed, if it doesn’t have this marking?

  14. So, what happens if I view the original image (and assume the void-pattern is not visible there, even though it is on my screen), and do a print-screen, then put that into Photoshop or the Gimp and start meddling away? Will the algorithm work then? Because else, this is about as useful as those right-click-blockers.

  15. I already see the original image is corrupted and the “VOID” is visible to my 35-year old eyes.

    So, back to the drawing board –the algorithm is useless.

  16. @Markus I suspect it’s also because a number of TFT LCDs are actually only 6 bit per channel anyway and use dithering to simulate more colors. i’ve seen similar effects on other checkerboard like patterns before from this.

  17. Decided to give my idea in the previous post a try. Check this link:
    http://folk.ntnu.no/asmunder/spoofed.png

    In the top half is the print screen of the original image.
    In the lower half is the same print screen, but recompressed with a jpeg quality setting of 60 (reported as the one showing the text most clearly).

    As you can see, there is some interference pattern in the lower part, but it does not spell out the word void in any way. So I guess you have yet to plug the “analog hole”.

  18. I can definitely see the 3-d image of the shark. That’s cool.

    You have to hold the image 8 inches away from your eyes, and sort of look “through” the image, like any stereographic images.

    I wonder how many people didn’t see that?

  19. 1. It degrades the quality of the original image.
    2. It is easily removable with the right filter.
    3. The copy looks better than the original.

    Every 5 years somebody comes up with this idea,
    grabs a grant to make it usable;
    And disappears…

  20. This is GENIUS! Hey, its not perfect, but I thoroughly enjoyed reading the analysis of compressed image blocks to determine if quantization error could be exploited. A very impressive display of human ingenuity!!

  21. I must be missing something. I put both of the “before” images into both Paint Shop Pro and MS Paint, tried saving them various ways, modified and unmodified, and I never got the cool “VOID” message… Kind of bummed. I really wanted to see this work, but it apparently doesn’t. I’m sure it works on something, but the effect is not universal.

  22. It didn’t work for me. I opened it in GIMP and saved it with different quality settings. It didn’t make a difference.

  23. This is a noble idea, but did the authors not think that folks would simply figure out that saving the original image as an uncompressed tif or psd would render a jpg-specific algorithm ineffective?

    JPG might be the most common algorithm in use, but it’s not the only one by a long shot. This might flummox the casual Web user, but the folks we need to worry about have proven to be quite crafty.

    FYI, I, too, can see the word “void” in the original image above. It’s faint, but discernible.

    This all sounds to me like nothing more than yet another ploy to extract a research grant from some gullible agency or another.

  24. Hopefully I can illuminate why people are seeing differing results on their LCD monitors. The original image is high frequency and high contrast, which doesn’t play well with the Overdrive technology used on modern LCDs to reduce response times (and thus reduce image ghosting). The result is visible Overdrive artifacts (appears as shimmering), and I suspect it is also what is causing some people to be able to see the VOID image. I tested this image on two monitors, one a modern 1080p 24″ TN panel using 18-bit HiFRC dithering (Acer P243W, connected via DVI) and the other an older 20″ S-IPS panel with true 24-bit color (Dell 2001FP, connected via DVI). The VOID image was easily visible on the TN panel, but much more faint (probably looking as intended) on the older S-IPS panel. Overdrive shimmer was also not visible on the S-IPS panel. I don’t believe that the color depth of the panel is significant, but it’s also the case that the older panel has much lower contrast, which could affect things. I also wonder if the effect might disappear if you use a lower resolution LCD that lets you more easily see individual pixels at normal viewing distances. I notice that on my TN panel, the VOID image begins to disappear when I get my face very close to the screen.

  25. I was originally tickled to hear about this. However, after looking at the sample image and testing it on my own computer, I believe it is fair to say that it suffers from the same weaknesses as other technologies like least significant bit stenography base copyright watermarking and the aforementioned physical currency based anti-copy protection systems.

    Like the stenographic systems, by applying a very very mild 1×1 or perhaps even less (0.25×0.25) pixel guassian blur filter, you can render the embedded protection message invisible. The high frequency patterns become blurred together into an array of varying density/luminosity spheres.

    Targetting the JPEG blocking algorithm is good, but it also means that the technique is not effective if a different algorithm is used or if there is even a mild amount of filtering applied.

    Even looking at the example page with my browser, because, for instance, Mac OSX applies an anti-aliasing filter, the embedded image is actually blurred out of existence by default, effectively hiding the message meant to be seen when the image was modified.

    I’m certain this technology, given more advancement, will have its uses. However, a one line update to most caching proxy stacks will render this method effectively useless.

  26. I copied the image and pasted it in Photoshop CS 4.

    Then, using the “Save for web” dialogue, I was able to make the word VOID clearly appear at the quality levels 66, 65, 63, 51, 49, 45, 42, 7, and 6.

    The letters were also perceptible at 89, 88, 87, 76, 74, 73, 72, 68 and 67.

    There were a few other quality settings where the words were almost visible, but not quite.

    However, if I saved the file using a quality setting where the word Void did not appear, and then used the Save for Web dialogue on the new re-compressed “clean” file, I was unable to see the word VOID at any quality setting from 0-100.

    So, this seems like a technique that might work for sending secret messages around in seemingly innocent pictures. Then, once the message is retrieved, all you have to do is re-compress the JPEG image at a setting that will remove the secret message.

  27. Great, yet another stupid way to create incompatibilities that cause things to break.

    In the original image, the word void is clearly visable at varios viewing angles. LCDs act funny when viewed off axis. it can affect gamma and even make intensity non-monotonic – even folded. Thus the average intensity is far from assured.

    Gamma correction adjustments on monitors and video drivers could affect the results.

    Plus rescaling images on display is a normal part of life. Hook up to a video projector or a monitor that must be run at other than its native mode. Variable bit depths are also normal. So is rescaling for mobile devices or for handicapped access.

    It is already broken with todays PC video display technology. Imagine what will happen with tomorrows. Or with the thousands of non-PC devices out there.

    This needs to be taken out and shot before stupid webmasters get a hold of it.

  28. This is not new at all
    they used to do it with tickets for shows and documentation to avoid photocopies.

    This works chanching slightly teh lineature of the VOID word, so that when you reproduce it in different quality, the difference becomes evident.

  29. I just tested this on my CRT monitor running at a resolution of 1024×768. I saved the image to my system and then used Irfanview to recompress and save it. Out of several tries, the VOID message only showed up once.

    I agree with the others who said that this is just a pointless complication that will end up being useless. There are many ways to get around this, not to mention that someone will probably create a plugin or filter specifically to remove the watermark. Plus, it only shows up if they recompress the image, if they leave it as-is, the watermark doesn’t do diddly.

    What’s next? Will you start putting all your text in images so that it can’t be copied with cut & paste?

    Region restricted DVDs, unskippable portions of DVDs, streaming video “rentals” that only work on certain operating systems with specialized software, streaming sites that are region restricted, video games that need to phone home every time you play them, PDF files that can’t be printed, digital music that only works if you maintain a monthly subscription, specific search terms being censored, ebooks having read-aloud features for the blind disabled, video game companies making it illegal to tamper with the hardware, phones and other devices with remote “kill-switches” for their content, PITA copy protection built into the HDMI video standard, and the entertainment industry fighting tooth and nail to keep any new technology that they don’t like, out of the hands of consumers or at least have it neutered until it meets their approval.

    Think what the state of technology would be like today if there weren’t bunches of people spending all their time trying to find ways to break that technology and beat it into submission…

Leave a Reply

Your email address will not be published. Required fields are marked *