is there a better function than the GD library imagejpeg?
I am having some quality issue (even using 85 as quality arg)
I need to upload an image (that can be a png,jpg,gif whatever) convert them in jpg using this function and then upload em to my webiste (in this case a db, but that's not the matter)
Currently using imagecreatefromstring
and then imagejpeg
the quality is just awful and the size sometime it gets bigger.
Any php开发者_StackOverflow社区 alternative to this awful gd (that you have tested..)?
Thanks
I personally prefer ImageMagick over GD. It does more and does it faster: http://ca2.php.net/imagick - it does require installing ImageMagick but it's worth it if you ask me.
GD's JPG filter is indeed not the best in terms of compression vs. image quality.
For photographs with extremely fine details, consider using an extremely high quality setting like 95 or even 99.
Alternatively, as @v0idnull suggests, ImageMagick is worth a shot.
Bear in mind that there are kinds of images that will never look good in JPG - vector illustrations, for example. JPG is best suited for photographs and other images with a lot of colour variation and few areas of exact the same colour.
Have you enabled interlacing? http://www.php.net/manual/en/function.imageinterlace.php You may also want to look into resampling the image before saving it.
If you are determined to move away from GD, you can look into the imagemagick PECL extensions (http://php.net/manual/en/book.imagick.php). A bit more trouble than GD since it is not built-in to php, but may be what you are looking for.
精彩评论