Embedding an image in an image so that it becomes invisible when resized

I’m trying to do something a little like steganography – that is, I want to embed an image in an image so that when it’s reduced to 50% size, the embedded image disappears and it becomes a plain color.

This is my attempt.

This is using Linear Dodge (Add) and Subtract blend modes in Photoshop, along with the respective layers being masked to alternating pixel columns.

When reduced to 50%, using bilinear or bicubic resampling, I’d like it to become just a plain color. Instead, it’s becoming this:

enter image description here

Why? The resultant colors of the Add and Subtract aren’t getting capped at 0 or 255. But, as we can see, lighter parts of the image are losing their red saturation.

How can I manipulate the images – ideally using Photoshop – to get the desired result?

My PSD is here, and the image I used is here.

Edit:

This is my second attempt:

And that exact same image, resized by your browser:

At least on mine, the A has disappeared. That is what I want, and I want Photoshop to calculate pixel colours rather than me have to do it manually.

Answer

I don’t think what you are trying to do is possible due to interpolation. But it depends somewhat on the intended use of the image and why you would want to do this.

Almost all raster applications will attempt to retain contrasting pixels upon resizing, some better than others. But I’ve never seen any raster image simply remove a section which covers more than 3 or 4 pixels of the entire image. Even then apps tend to retain 1 pixel if the contrast is high enough.

Realize that pixels, in general, are square and not vertical lines. Your masking is similar to that of a lenticular – you know those 3D prints where one way it looks like photo A and the other way it looks like photo B. The reason those work is due to the vertical prism covering and a very precise set of image slices underneath.

This is why I think it’s impossible when using pixels. The only possible method may be to surround every image pixel with 6 solid color pixels in the hopes that upon reduction interpolation would see the image pixel as unnecessary and remove it. But again, that is unlikely because most apps are inherently coded to try and retain contrasting pixels.

Realize your blending modes don’t really effect the image in any way once you save it. They only work in Photoshop to alter the appearance. You can achieve the same tonal value in much simpler ways, such as merely reducing opacity of a white pixel.

This image is solid red with a few 30% white pixels in the middle. The white pixels are spaced to allow 6 red pixels around each of them. This equates to 2 red pixels between each white pixel.

pixels

Clearly they are visible.

Upon a 50% reduction:

reduction

You can see they are still visible.

Reducing original white pixels down to a 20% opacity makes them difficult to see before reduction.

20 percent

And after reduction:

20 reduction

They are almost equally visible.

When you increase the amount of white pixels (Still at 20% opacity):

bigger

The original gets easier to see and upon reduction it’s still there.

20 red

Clearly none of this is making the pixels vanish. So it would take some trial and error to discover the distance between and opacity of a group of contrasting pixels before interpolation makes them vanish. That would be the sweet spot.

In the image below the white pixels are set to 30% opacity. Each white pixels is 8 pixels away from any other white pixel.

8 pixels

Upon a 50% reduction:

8 reduction

You have to look really hard to see the white pixels (but they still haven’t vanished). This may work depending on the size of the image. But clearly the further away the contrasting pixels are from each other the better the result.

Taking the larger image above, opening that image in a browser, and using the browser to reduce the image, will effectively make the white pixels vanish. So, if you’re looking for a solution for a browser, this may actually work. And in fact, placing the larger image in an html page at it’s original size of 500x500pixels and then using html to set the image size to 250x250pixels, seems to remove the white pixels as well. See a demo of this here

So let’s test with the portrait. I created a grid of pixels space 8 pixels apart and used that to mask the face over the red background:

face

Pixels are so far apart the message of the image gets lost.

Reducing to 50% via Photoshop, doesn’t really do anything other than make it all smaller:

face@50%

Dropping the full size image onto a browser window and reducing in the browser via Command/Ctrl-minus down to 50% obscures the face a bit more. However something is still clearly there. (This is a screenshot of the browser window)

screenshot@50%

And reducing one more step in a browser window down to 33% seems to hide the white pixels for the most part. if you scrutinize the image, you can still detect some white pixels, but it’s unlikely most viewers would look for them. (This is a also screenshot of the browser window):

Screenshot@33%

So….. the problem becomes how far apart can you make pixels and still convey an image? And, how much time are you willing to dedicate to separating individual pixels to create that image?

Attribution
Source : Link , Question Author : Max , Answer Author : Scott

Leave a Comment