title: Want to use imagecopy or imagecopyresampled with 50% opacity
body: <p>I am using PHP GD <code>imagecopy</code> or <code>imagecopyresampled</code> to merge a PNG image with transparency onto another PNG image (basically creating t-shirt mockups with design).</p>
  
  <p>When I use imagecopymerge() it doesn't respect the transparency. but opacity setting option works. But when I use <code>imagecopy()</code> or <code>imagecopyresampled()</code> then transparency works but opacity setting is not available.</p>
  
  <p>So how to merge images which respects transparency and provides 50% opacity as well?</p>
  
  <p>My code is:</p>
  
  <pre><code>$img1 = imagecreatefrompng('m1.png');
  $img2 = imagecreatefrompng('m2.png');
  
  imagealphablending( $img2, false );
  imagesavealpha( $img2, true );
  
  $x1 = imagesx($img1);
  $y1 = imagesy($img1);
  $x2 = imagesx($img2);
  $y2 = imagesy($img2);
  
  //imagecopyresampled($img1, $img2, 205, 170, 0, 0, $x2-40, $y2-40, $x2, $y2);
  imagecopy($img1, $img2, 205, 170, 0, 0, $x2-40, $y2-40);
  
  header('Content-Type: image/png');
  imagepng($img1);
  </code></pre>
  
  <p>Please help.</p>