1. <?php
  2. $file='arrow.png';
  3. list($width, $height, $type, $attr) = GetImageSize($file);
  4. $im = ImageCreate($width, $height);
  5. $im2= ImageCreateFromPng($file);
  6. $bg = ImageColorAllocate($im, 255, 0, 255); //tło
  7. imagecopy($im, $im2, 0, 0, 0, 0, $width, $height);
  8. imagepng($im);
  9. ImageDestroy($im);
  10. ?>

Plik arrow.png ma przeźroczyste tło, lecz gdy nałożę go na generowany obraz tło jest czarne, ten skrypt ma na celu zmianę tła obrazu.