Menu

#8 GD: Use imagecopyresampled() instead of imagecopyresized()

open
nobody
None
5
2008-03-14
2008-03-14
Skyzyx
No

When resizing images using the GD driver, I noticed that that the resulting images were rather... rough. I realized that this was because the resized images were not being resampled.

Image resizing is the only functionality I'm really using at the moment, so I only made the resampling modification to asido_driver_gd::__resize().

imagecopyresampled() has an identical function signature to imagecopyresize(), so it was simply a matter of changing the function name and I was done.

It would definitely be useful to work this into a future revision of Asido, perhaps with a way to toggle it (as resampling looks cleaner/nicer, but requires more memory and CPU).

Discussion

  • Vincent Lemaire

    Vincent Lemaire - 2008-04-17

    Logged In: YES
    user_id=2065743
    Originator: NO

    I fully agree with it : please change the function for more quality of pictures resizing.

     
  • Vincent Lemaire

    Vincent Lemaire - 2008-04-17

    Logged In: YES
    user_id=2065743
    Originator: NO

    If you want a patch...

    Index: class.driver.gd.php

    --- class.driver.gd.php (revision 18)
    +++ class.driver.gd.php (working copy)
    @@ -181,7 +181,7 @@
    imageSaveAlpha($_, true);
    imageAlphaBlending($_, false);

    - $r = imageCopyResized(
    + $r = imageCopyResampled(
    $_, $tmp->target,
    0,0,
    0,0,

     

Log in to post a comment.