note 38652 added to function.imagejpeg
| From: | gzink at zinkconsulting dot com | Date: | Thu, 01 Jan 2004 08:17:00 +0000 |
| Subject: | note 38652 added to function.imagejpeg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62739@lists.php.net to get a copy of this message | ||
Don't forget that JPEG compression has artifacts! And they're not all really obvious. The
PHP JPEG compression is pretty decent, but it seems to generally:
-Lighten the image overall, by a reasonable amount (never seen this before, but it will drive
graphic designers crazy, you might want to darken the image before compressing it)
-Reduce saturation, especially with images with lots of points of different color within a few
pixels of each other (this is a documented feature of JPEG)
-Seriously mess with blue colors, which is common to all JPEG but really annoying in some situations
with blue and black or other detailed blue parts
You might want to consider using imagepng() and outputting a PNG image instead of a JPEG if any of
the above affect you, or your image is not very photo-like. Sometimes I have an algorithm compare
JPEG to PNG for an image and send the smaller version to the user.
Also, when using imagepng(), you should use imageinterlace() before it 95% of the time. Interlaced
JPEGs load progressively, improving in quality as the image loads, so users on slower connections
see the whole image at low quality. All this happens without affecting the file size (actually,
sometimes the file size is smaller!) or final quality.
Hope this helps a few people out. It's not all that obvious without lots of playing around.
-Galen
http://zinkconsulting.com/
----
Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38652
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38652&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38652&report=yes
Search -- http://master.php.net/manage/user-notes.php