If you want to preserve pixelization during resizing, you will want to do something similar using the GD library:
<?php
$src = imagecreatefromgif('test.gif');
$dest = imagecreate(64, 64);
imagecopyresized($dest, $src, 0, 0, 0, 0, 64, 64, 16, 16);
header('Content-type: image/gif');
imagegif($dest);
?>
I checked the code and the pixelation remains in tact. You will have to adapt the code to also accept png files as input, which should be fairly simple, since each of the GD gif functions also has corresponding png functions. Hope this helps.
source
share