-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poor maximum JPEG quality. #18
Comments
Hurts me too - I'd have expected no artefacts at quality 100. BTW, is there some "uncompressed" saving of JPEGs? I'd need them only as mjpeg stream for ffmpeg, any saved CPU load would be welcome. Originally posted by phmarek (phmarek) on May 28 2012 via Bitbucket |
afair jpeg8 and later offers lossless compression. I did not test yet if the 100 quality goes lossless or if we need an extra option. Originally posted by pierrejoye (Pierre Joye) on Apr 16 2013 via Bitbucket |
The demo page ( http://oserv.org/bugs/gd/ ) now works again, I re-uploaded it. Originally posted by ChALkeR (ChALkeR) on Aug 05 2013 via Bitbucket |
Hi here =). I am the original issue reporter. |
The issue is still valid as of libgd 2.1.1. |
if you could attach a small testcase, it would help |
@vapier <?php
$image = imagecreatefrompng('test1.png');
header('Content-Type: image/jpeg');
imagejpeg($image, null, 100); test1.png: http://oserv.org/bugs/gd/test1.png or http://oserv.org/bugs/gd/test.png |
I am not sure what we can change here without providing full tables customization. We simply pass the value to jpeg_set_quality. And you are right too, current jpeg support does not provide lossless write support. Which command line or code did you use for imagick? Imagemagick does a lot of magics depending on the arguments :) |
Any of those are better than gd with quality 100. |
On |
comparing the
and when i make a similar change to jpeg_set_defaults(&cinfo);
+ cinfo.comp_info[0].h_samp_factor = 1;
+ cinfo.comp_info[0].v_samp_factor = 1; guess we should use the algos in imagemagick's jpeg.c to figure out what samp factors to use ? |
The 1st one (q=100) could be done easily but may drastically increase the file size by default as you can see with the images in this report. This special case is also very particular as it uses anti-aliasing text patterns which per se are impossible hard to compress nicely from a visual point of view. The default sampling factor in recent libjpeg (turbo) targets photographies more than text or patterns. PNG fits better for that. One thing I like to add for 2.3 is to expose the parameters for Codecs like jpeg or PNG. Can be handy. |
i think a good trade off is to set the scale factor to 1x1 when quality is >= 90, otherwise let jpeg do its default (2x2). i agree that exposing the lower API makes sense. let's split that into a new issue though ? |
should do it. I will apply + test tomorrow. |
lgtm! |
our 4th oldest issue closed out! :D |
* GD-2.2: #18 add exp and src images
:) Also fixed the test to get the actual diff. I will also try to add a better perceptual diff for the tests suite. The current is rather useless without threshold for these cases. |
Thanks! |
@vapier Thanks for fixing the makefile :) And as reference for future readers or doc about sampling http://www.impulseadventure.com/photo/chroma-subsampling.html |
The maximum JPEG quality is poor comparing to other tools, like ImageMagick or Photoshop.
The colors are lost even at quality=100.
See http://oserv.org/bugs/gd/ for original (.png) / GD(.gd.jpg) / ImageMagick (*.im.jpg) comparison.
Everything was done using maximum quality settings.
Was tested using php and perl, the results are the same.
The text was updated successfully, but these errors were encountered: