I'm working on a project where I edit the pixels of a jpg in PHP using the GD library. Its very crucial and key to my project that the output from PHP retains the pixel values I set (cough-steganography-cough).
This is the first time I've attempted image manipulation in PHP. I've had no problems before in my Java implementations, so I was foolish not to investigate GD's jpeg
compression quality before pursuing further.
It turns out that after all my effort, my code does not function the way its supposed to. I am pretty sure it is not my code (tested the encode and decode functions on edited image resources and they worked).
My questions are:
The only problem I can see is with imagejpeg()
's compression. Could I be right?
Are there any libraries that provide the compression that I need?(retain pixel values that I changed)
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