Copy and merge png image in PHP

Description

The following code shows how to copy and merge png image.

Example


//from  www  .ja  va  2 s.  com
<?php
$baseimage = ImageCreateFromPNG("test.png");

$myImage = ImageCreateFromPNG("testNew.png");
$gray = ImageColorAllocate($myImage, 18, 18, 18);
ImageColorTransparent($myImage, $gray);
ImageCopyMerge($baseimage,$myImage,0,0,0,0,15,15,10);

header ("Content-type: image/png");
ImagePNG($baseimage);

ImageDestroy($baseimage);
?>

The code above generates the following result.

Copy and merge png image in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text