This heavily depends on the way the particular image format works. You'll need to dive into the internals of the format you want to use.
For JPEG, you could fiddle with the last bits of the DCT coefficients for each block.
For palette-based files (GIFs, and some PNGs), you could add extra colours to the palette that look identical to the existing ones, and encode information based on which one you use.
You'll have to distinguish between pixel-based (Bitmap) and palette-based formats (GIF) for which the steganographic technique is quite different. Also be aware that there are image formats like JPG that lose information in the compression process.
I'd also advice some general introduction to steganography including different formats.
最低有效位方法不适用于 JPEG 和 GIF 图像,因为您在压缩前使用像素数据(原始图像)来存储隐藏信息。数据为 0x123456 的像素 p 在压缩后可能不会具有该值,因为其值取决于压缩率和相邻像素。在本例中,我们讨论的算法不仅会压缩图像(如 ZIP,保留内容),还会更改颜色分布、纹理和质量,以减少表示图像的位数。
然而,PNG 只能用于以与 ZIP 文件相同的方式压缩图像,保留内容。因此,您可以对 PNG 图像使用最低有效位,以便维基百科隐写术页面显示此格式的示例。
Least Significant Bit approach does not work with JPEG and GIF images because you are using the pixel data (raw image) to store hidden information before compression. A pixel p, with data 0x123456 will probably not have this value after compression because its value depends on the compression rate and neighbour pixels. In this case we are talking about algorithms that does not only compact the image (like a ZIP, that keeps the content), but changes the color distribution, texture, and quality in order to decrease the number of bits to represent it.
However, PNG can be used just to compact the image in the same sense of ZIP file, keeping the content. Therefore, you can use the Least Significant Bit for PNG images, so that Wikipedia Steganography page shows example in this format.
As long as the image format is lossless, you can use the LSB steganography in pixels (BMP, PNG, TIFF, PPM). If it is lossy, you have to try something else, as compression and subsequent decompression cause small changes in the pixels and the message is gone. In GIF, you can embed your message into the palette. In JPEG you change the DCT coefficients, a low-level frequency representation of the image, which can be read from and saved as JPEG file losslessly.
There is an extensive research on steganography in JPEG. For introduction, I personally recommend Steganography in Digital Media: Principles, Algorithms, and Applications by Jessica Fridrich - must-read material for serious attempts in steganography. The approaches for various image formats are discussed in-depth there.
Also, LSB is inefficient and very easily detectable, you should not use that. There are better algorithms, however usually heavy on math and complex. Look for "steganography embedding distortion" and "steganography codes".
发布评论
评论(4)
这在很大程度上取决于特定图像格式的工作方式。您需要深入了解您想要使用的格式的内部结构。
对于 JPEG,您可以修改每个块的 DCT 系数的最后一位。
对于基于调色板的文件(GIF 和某些 PNG),您可以向调色板添加与现有颜色相同的额外颜色,并根据您使用的颜色对信息进行编码。
This heavily depends on the way the particular image format works. You'll need to dive into the internals of the format you want to use.
For JPEG, you could fiddle with the last bits of the DCT coefficients for each block.
For palette-based files (GIFs, and some PNGs), you could add extra colours to the palette that look identical to the existing ones, and encode information based on which one you use.
您必须区分基于像素(位图)和基于调色板的格式(GIF),这两种格式的隐写技术有很大不同。另请注意,有些图像格式(例如 JPG)会在压缩过程中丢失信息。
我还建议一些关于隐写术的一般介绍,包括不同的格式。
You'll have to distinguish between pixel-based (Bitmap) and palette-based formats (GIF) for which the steganographic technique is quite different. Also be aware that there are image formats like JPG that lose information in the compression process.
I'd also advice some general introduction to steganography including different formats.
最低有效位方法不适用于 JPEG 和 GIF 图像,因为您在压缩前使用像素数据(原始图像)来存储隐藏信息。数据为 0x123456 的像素 p 在压缩后可能不会具有该值,因为其值取决于压缩率和相邻像素。在本例中,我们讨论的算法不仅会压缩图像(如 ZIP,保留内容),还会更改颜色分布、纹理和质量,以减少表示图像的位数。
然而,PNG 只能用于以与 ZIP 文件相同的方式压缩图像,保留内容。因此,您可以对 PNG 图像使用最低有效位,以便维基百科隐写术页面显示此格式的示例。
Least Significant Bit approach does not work with JPEG and GIF images because you are using the pixel data (raw image) to store hidden information before compression. A pixel p, with data 0x123456 will probably not have this value after compression because its value depends on the compression rate and neighbour pixels. In this case we are talking about algorithms that does not only compact the image (like a ZIP, that keeps the content), but changes the color distribution, texture, and quality in order to decrease the number of bits to represent it.
However, PNG can be used just to compact the image in the same sense of ZIP file, keeping the content. Therefore, you can use the Least Significant Bit for PNG images, so that Wikipedia Steganography page shows example in this format.
只要图像格式是无损的,您就可以使用以像素为单位的 LSB 隐写术(BMP、PNG、TIFF、PPM)。如果它是有损的,您必须尝试其他方法,因为压缩和随后的解压缩会导致像素发生微小变化,并且消息会消失。在 GIF 中,您可以将消息嵌入到调色板中。在 JPEG 中,您可以更改 DCT 系数,这是图像的低级频率表示形式,可以无损读取并保存为 JPEG 文件。
关于 JPEG 隐写术有广泛的研究。作为介绍,我个人推荐杰西卡·弗里德里希(Jessica Fridrich)撰写的《数字媒体中的隐写术:原理、算法和应用》——认真尝试隐写术的必读材料。那里深入讨论了各种图像格式的方法。
另外,LSB 效率低下并且很容易被检测到,您不应该使用它。有更好的算法,但通常数学复杂且复杂。查找“隐写术嵌入失真”和“隐写术代码”。
As long as the image format is lossless, you can use the LSB steganography in pixels (BMP, PNG, TIFF, PPM). If it is lossy, you have to try something else, as compression and subsequent decompression cause small changes in the pixels and the message is gone. In GIF, you can embed your message into the palette. In JPEG you change the DCT coefficients, a low-level frequency representation of the image, which can be read from and saved as JPEG file losslessly.
There is an extensive research on steganography in JPEG. For introduction, I personally recommend Steganography in Digital Media: Principles, Algorithms, and Applications by Jessica Fridrich - must-read material for serious attempts in steganography. The approaches for various image formats are discussed in-depth there.
Also, LSB is inefficient and very easily detectable, you should not use that. There are better algorithms, however usually heavy on math and complex. Look for "steganography embedding distortion" and "steganography codes".