So I have this question. I downloaded a .BMP off google due to .BMPs being not compressed. Just a 1024x768 .BMP image which its size os of 2.25Mb. I put the image in a steganography application.. inserted hidden text within it, encrypted and everything. How come the resulting image (Steganographied Image) is still 2.25Mb in size? Isn't it supposed to get bigger?
4 Answers
If you consider the mechanics of embedding the image in it's simplest form, then all you do is repurpose some of the existing bits. The following is a Wikipedia extract from an article on steganography:-
For example, a 24-bit bitmap uses 8 bits to represent each of the three color values (red, green, and blue) of each pixel. The blue alone has $2^8{}{}$ different levels of blue intensity. The difference between 11111111 and 11111110 in the value for blue intensity is likely to be undetectable by the human eye. Therefore, the least significant bit can be used more or less undetectably for something else other than color information. If that is repeated for the green and the red elements of each pixel as well, it is possible to encode one letter of ASCII text for every three pixels.
which kinda looks like this:-
except that your message is encrypted. So the image remains exactly the same size.
The issue facing you (and your software) is how many bits can you alter and remain unnoticed? One certainly. The above example uses two and the altered image looks similar. Could you use three then? Clearly seven bits would totally destroy the image and tip off the attackers. It's a balance between leveraging the unavoidable noise introduced by the image digitisation process, the artistic scene and how dangerously you like to live.
Generally the blue channel is the noisiest from a CMOS/CCD sensor point of view. You might be able to inject additional bits into that channel without significant human detection.
Note: There are more advanced embedding methods that can alter the discrete cosine transform coefficients inside a JPEG file. This allows JPEGs to hide messages that would otherwise be impossible in this lossy format. There's a pretty good summary of advanced methods within the introduction to Data hiding inside JPEG images with high resistance to steganalysis using a novel technique: DCT-M3.
- 402
- 2
- 11
- 15,905
- 2
- 32
- 83
I think you need to understand that Steganography does not add data to the image, but instead replaces some of the original data in the image. In your case, the replaced data is the LSB (least significant bit) of specific color channels. The original values of the LSB's in those channels are lost, and the data you want to hide comes in to replace it. Therefore it does not introduce any extra size to the processed image (ignoring compression which can be affected, but not for BMP which is some raw data without compression).
- 284
- 6
- 12
The entire goal of Steganography is that someone examining the image cannot determine whether there is an encoded message in there or not.
Now, your original .BMP image consisted of 1024x768 3 byte values (the red, green and blue values).
Because that's the format of the original image, the image with the encoded message had to be in the same format. If Steganography changed the format, that might be a tip off that the image included a message.
Instead, the image with the message had to also consist of 1024x768 3 byte values, and so it is also $1024 \times 768 \times 3 = 2.25 \text { Meg}$ long.
- 154,064
- 12
- 239
- 382
You can remove steganography from the question and still use the same answer.
The bitmap with those attributes will always be the same size.
1024 * 768 pixels * 24 bits per pixel / 8 bits per byte / 1024 bytes per kilobyte = 2304.0 kilobytes / 1024 = 2.25
Applications and algorithms decide how to encode the data. Some methods of encoding change or diminish the visual appearance so it can skim bits to use for other purposes.
For example, one might encode data in an image by changing each byte to even/odd in order to signify a binary digit (0 or 1). That stream of even/odd becomes a place for you to write your own data. The pixels change, but you don't notice.
EDIT: If you use a compressed bitmap, then the output files will become larger as you seem to expect. That's because the compression cannot escape the fact that new unique data was added.
- 151
- 5
