GD imagejpeg() compression?

こ雲淡風輕ζ 提交于 2019-12-05 18:53:32

The JPEG file format is not very suitable for steganography if you do the steganography pixel by pixel.

JPEG uses an image compression - that even with maximum quality - that will destroy the information on the bit level on each pixel. The jpeg type of compression (lossy compression) is made for the human eye/brain to retain the image but not the bits of the image in the file .

You need to use an image format that is capable to retain the pixels - as you wrote it already as well. Such a format more likely is BMP with RLE compression or the TIFF image format with ZIP or RLE compression. That's called lossless data compression.

By default the quality of the image output from imagejpeg is 75, Try setting it at 100 to get the image at full quality.

  bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )

Check the manual for further details.

Also try using imagecopyresampled. (I think you would have been using imagecopyresized somewhere in your code. Use imagecopyresampled instead of it. )

EDIT

Then I think you should try ImageMagick(or GD2). It gives a better quality than GD . Check this

Use the imagepng() instead of the imagejpeg() function and set the compression to 0 :

bool imagepng ( resource $image [, string $filename [, int $quality [, int $filters ]]] )

See : http://php.net/manual/en/function.imagepng.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!