What potential pitfalls should be considered when using transparent images in PHP?

When using transparent images in PHP, one potential pitfall to consider is that the transparency may not be preserved properly when manipulating the image. This can result in unexpected or unintended visual effects. To ensure that transparency is preserved, it is important to use image functions that support transparency, such as imagepng() with the PNG format.

// Example code snippet to preserve transparency when saving a PNG image
$source = imagecreatefrompng('source.png');
$destination = 'destination.png';

imagealphablending($source, false);
imagesavealpha($source, true);

imagepng($source, $destination);
imagedestroy($source);