#49696 [Opn->Asn]: PHP GD library can use underlying JPEG library's capability to prescale image
| From: | pajoye@php.net | Date: | Mon, 28 Sep 2009 08:36:30 +0000 |
| Subject: | #49696 [Opn->Asn]: PHP GD library can use underlying JPEG library's capability to prescale image | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142989@lists.php.net to get a copy of this message | ||
ID: 49696
Updated by: pajoye@php.net
Reported By: sriram dot natarajan at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Feature/Change Request
Operating System: unix/linux
PHP Version: 5.3SVN-2009-09-28 (snap)
-Assigned To:
+Assigned To: pajoye
New Comment:
I have a patch for libgd and jpeglib7 to allow exactly that. However a
manual scale is still necessary if you like to have a good result.
Previous Comments:
------------------------------------------------------------------------
[2009-09-28 05:03:53] sriram dot natarajan at gmail dot com
Description:
------------
GD library is commonly used in PHP5 applications for image processing.
When creating thumbnails from a large jpeg image, the original image
currently has to be decoded to a full-size copy before being resampled
or resized. This is a relatively expensive step. The underlying jpeg
library has a capability of prescaling an image when it is being
decoded, so for example the decoded image could be only 1/16 the size of
the fullsize image by prescaling by a factor of 4. This saves a
substantial amount of cpu time.
Expected result:
----------------
we can update php libgd library and our php gd extension to leverage
underlying jpeg's ability to prescale image at the time of creating jpeg
images.
for example, we can introduce new API or patch our existing
gdImageCreateFromJpeg API to have an extra argument for prescale size so
that we can set the value of 'prescale' value like below
cinfo.scale_denom = prescale;
before calling "jpeg_start_decompress (&cinfo)" function.
[credits: thanks to Richard Smith for coming up with this nice
suggestion]
af course, this will allow users to invoke our 'imagecreatefromjpeg'
with an optional argument which specifies the prescale size of this
jpeg.
$src_img=imagecreatefromjpeg($name, 4);
Actual result:
--------------
better performance while producing jpeg based thumbnails
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49696&edit=1