Jump to content

Image rotate losing transparency


tobeyt23

Recommended Posts

I have the following code, works rotates the image. But it seems to lose its transparency and add color when rotated to say 45. How can I avoid this?

 

// File and rotation
$filename = 'placeholder.png';
$degrees = 45;

// Content type
header('Content-type: image/png');

// Load
$source = imagecreatefrompng($filename);


// Rotate
$rotate = imagerotate($source, $degrees, 0);

// Output
imagepng($rotate);
?>

Link to comment
https://forums.phpfreaks.com/topic/211170-image-rotate-losing-transparency/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.