Phine Solutions web work notes

imagecreateresampled vs. imagecreateresized

Filed under: PHP development by 1.618 — December 11, 2006 4:56 pm

If you are using image manipulation functions in PHP to resize a image, a common mistake is to use the imagecreateresized() function. Actually, most of the time, imagecreateresampled() function should be used.

According to the API document, imagecreateresampled()

copies a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity.

This brings the question that if imagecreateresampled() produce better image, why do we still need imagecreateresized() at all? My take on this is that the latter, although not creating as pretty image as the former one, executes much faster since less smoothing (anti-aliasing) is done during the process.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

©phinesolutions.com