LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: ShadowRoze Date: Tue Jun 10 13:35:16 2008 Subject: Re: [GD-DEVEL] Advanced image resize
Pierre Joye skrev: > On Tue, Jun 10, 2008 at 6:58 PM, ShadowRoze <roze@laun.se> wrote: > >> I load the following types with the script utilizing the function: jpeg, >> gif, png. >> Not using ImageColorsForIndex results in having to use bitshifting instead. > > Which is faster than calling the function and access the array table elements. > >> After trying to implement all your suggestions the time required increased >> with 50% (ergo, to 30s). > > I was not clear or you did something wrong (see below). I'm also not > sure why you copy the images twice (except if you want to copy it over > itself), filling it neither. > > If you like to have a specific color (or translucent) for the > uncovered area, you can use imagefilledrectangle and only with the > desired area(s). It will also spare you some cycles (flood fill is > slow). > >> Guess I'll have to wait for that one then. > > Well, as I said, you are missing the main goal of this algorithm. To > use bicubic for reducing the size of an image is completely useless > (be in C, php or whatever else). > > I also wonder why you don't use imagecopyresampled. Sorry, I checked and notice I used imagecopyresized (for its speed), however, I changed to resampled, and still was quite unhappy about the speed, even thou it went down to ~2s. But solved it with db-files for cache. Thanks anyway. > Now about the possible optimization of your scripts, using only > truecolor images and the other things I listed earlier: > > (in second) > ImageCopyResampledBicubic: 1.76 > ImageCopyResampledBicubic2: 21.46 > ImageCopyResampledBicubic: 31.84 > > The sources image is 3072x2034 and resized to 550x275. > > Results can be seen here: > > http://pierre.libgd.org/resize/ > > I don't see any relevant differences, nothing than can justify a PHP > implementation. > > I'm pretty sure to drastically reduce these numbers by using a simpler > algorithm without visible impact. > > If you load a png, verify if the image is truecolor, if not you can > use your version, if not it is fine to use Bicubic2. > > > Cheers, > -- > Pierre > > http://blog.thepimp.net | http://www.libgd.org
| Navigate in group php.gd.devel at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |