There seem to be craploads of problems to do with resizing and rotating them, but I haven't come across anythong like my current problem: The alpha is off by one pixel, in the x axis only.
Here's the code:
Code: Select all
$im = imagecreatefrompng($_FILES['uploadedfile']['tmp_name']); $sizes = getimagesize($_FILES['uploadedfile']['tmp_name']); $imtc = imagecreatetruecolor($sizes, $sizes); $transparent = imagecolorallocate($imtc, 255, 0, 255); imagefilledrectangle($imtc, 0, 0, $sizes, $sizes, $transparent); imagecopy($imtc, $im, 0, 0, 0, 0, $sizes, $sizes); imagecolortransparent($imtc, $transparent); //files output here are not transparent at all imagetruecolortopalette($imtc, false, 32); imagegif($imtc, 'result.gif'); //this file's alpha is correct other than being x+1.
This seems to be a byproduct of the imagetruecolortopalette function as noted above.
Could I alter the pixel data itself? Would it matter? Thanks a lot for any help!