How many bits(maximum number of bits) can be embedded in a pixel?

5.4k views Asked by At

I have an gray scale image of sixe 512x512. Thus, each pixel contains 8 bits. Can I embed a total of 8 bits into the pixels I wish to embed data in? Is this possible? (I require the image only for embedding data). In case I want to embed data in 10,000 pixels out of the total 512*512 pixels, can I then in total embed 80,000 bits of data or 10kB of data?

2

There are 2 answers

10
rudolph1024 On BEST ANSWER

A standard grayscale image with 256 levels for each pixel requires 8 bits per pixel. This is because 8 bits are required to encode 256 different levels. If you have an image with dimensions 512 x 512 then the total number of pixels in the entire image is 262,144 pixels. So, the entire image contains 8 bits * 262,144 = 2,097,152 bits worth of information.

If you were to take a subset of these pixels and encode 8 bits of "different" information, note that the resulting image would likely change in appearance. The 8 bits of information at each pixel coordinate previously encoded the pixel intensity (from 0 to 255). If you are replacing this value with some other value then the intensity will be different and the overall image will appear different.

1
Nick is tired On

If you want to embed 10KiB of data in a 512x512 image, where the bit depth is 8 bits, I'd recommend just storing 1 bit of data in every second pixel by changing the LSB of each.

Changing just 1 bit of data from every other pixel allows you to store (512*512*1)/2 bits of data, or 16KiB of data. This way you can store all of the data that you need to while only changing the image in a very limited way.

As an example, here's an image with varying amounts of white-noise embedded within it (by embedding n bytes per pixel), you can see how much noise(data) is embedded in the table below:

Images

X | Y | bits used | data(KiB)
0 | 0 | 0         | 0
1 | 0 | 1         | 32
0 | 1 | 2         | 64
1 | 1 | 3         | 96
0 | 2 | 4         | 128
1 | 2 | 5         | 160
0 | 3 | 6         | 192
1 | 3 | 7         | 224
_ | _ | 8         | 256 (image omitted as just white noise)

As can be seen, embedding up to 64KiB of data into a 512x512x8 image is perfectly reasonable expecting little noticeable change in the image by editing the 2 LSB of each pixel, so that a pixel is encoded as:

XXXX XXYY

Where X came from the original image, and Y is 2 bits of the stored data.