Jump to content

How to get rid of this black line around this png image with PHP?


yepster123

Recommended Posts

This script merges / watermarks too images together and then saves that final image to my server. But when it saves it to the server a black line appears around the new saved image on the corners on the image. The png image before the merge didnt have the black line. How do i get rid of it.

<?php 

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

$watermark = imagecreatefrompng('watermark.png'); 

$watermark_width = imagesx($watermark); 

$watermark_height = imagesy($watermark); 

$image = imagecreatetruecolor($watermark_width, $watermark_height); 

$image = imagecreatefrompng($_GET['src']); 

$size = getimagesize($_GET['src']); 

$dest_x = $size[0] - $watermark_width - 2; 

$dest_y = $size[1] - $watermark_height - 25; 

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);

imagepng($image);

imagepng($image, 'lightwaves.png');

?>

  • 2 weeks later...

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.