55

These all seem to do the same thing. What are the pros/cons of each.

imagecopyresized() vs imagecopyresampled() vs imagecopy().

I'm resizing a user submitted image.

So I have an image shell created with '$newImage=imagecreatetruecolor(250, 250)'.

And now I want to copy the orginal image into the '$newImage'

seamus
  • 2,681
  • 7
  • 26
  • 49

1 Answers1

116

imagecopyresized will copy and scale and image. This uses a fairly primitive algorithm that tends to yield more pixelated results.

imagecopyresampled will copy and scale and image, it uses a smoothing and pixel interpolating algorithm that will generally yield much better results then imagecopyresized at the cost of a little cpu usage.

imagecopy will copy but will not scale the image.

tivnet
  • 1,898
  • 17
  • 19
Orangepill
  • 24,500
  • 3
  • 42
  • 63
  • 7
    Thanks for the clear and precise answer. Do you know of any difference in performance and/or quality with the imagescale() function? – sylbru Apr 24 '15 at 09:47
  • What do you mean by "at the cost of a little cpu usage"? More than `imagecopyresized` I assume? – Slava Mar 15 '16 at 12:42