title: How to find pixel in image using Imagick
body: <p><a href="https://i.stack.imgur.com/OOpMZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OOpMZ.jpg" alt="enter image description here"></a></p>
  
  <p>This is my first demo and the code is shown below.</p>
  
  <pre><code>&lt;?php
  
       $overlay = new \Imagick( realpath ("c:/wamp64/www/photo_effect/photos/3809.jpg" ) );
       $imagick = new \Imagick( realpath ( "c:/wamp64/www/photo_effect/photos/overly.png" ) );
  
       $overlay-&gt;setImageVirtualPixelMethod ( \Imagick::VIRTUALPIXELMETHOD_TRANSPARENT );
  
       $width = $overlay-&gt;getImageWidth ();
       $height = $overlay-&gt;getImageHeight ();
  
       $offset = 332.9;
  
       $points = array (
             0 ,0 ,364,51 ,
             $width ,0 ,473.4 ,23 ,
             0 ,$height ,433.5  ,182 ,
             $width ,$height ,523  ,119.4
        );
  
       //$overlay-&gt;modulateImage (97,100,0);
       $overlay-&gt;distortImage ( \Imagick::DISTORTION_PERSPECTIVE ,$points ,true );
  
       $imagick-&gt;compositeImage ( $overlay ,\Imagick::COMPOSITE_OVER ,364.5 - $offset ,23.5 );
  
       $imagick-&gt;writeImage ( "c:/wamp64/www/photo_effect/uploads/real.jpg" );
  
  ?&gt;
  </code></pre>
  
  <blockquote>
    <p>When I use another image, it does not fit in this frame background image.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/5pLcL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5pLcL.jpg" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>This is my demo</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/RUhbu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUhbu.jpg" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?php
  
      $overlay = new \Imagick( realpath ( "c:/wamp64/www/photo_effect/photos/3809.jpg" ) );
      $imagick = new \Imagick( realpath ( "c:/wamp64/www/photo_effect/photos/Frame.png" ) );
  
      $overlay-&gt;setImageVirtualPixelMethod ( \Imagick::VIRTUALPIXELMETHOD_TRANSPARENT );
  
      $width = $overlay-&gt;getImageWidth ();
      $height = $overlay-&gt;getImageHeight ();
  
      //$offset = 100.9;
  
      $points = array (
           0 ,0 ,364,51 ,
           $width ,0 ,473.4 ,23 ,
           0 ,$height ,200,349 ,
           $width ,$height ,714,349
      );
  
     //$overlay-&gt;modulateImage (97,100,0);
     $overlay-&gt;distortImage ( \Imagick::DISTORTION_PERSPECTIVE ,$points ,true );
  
     $imagick-&gt;compositeImage ( $overlay ,\Imagick::COMPOSITE_OVER ,364.5 ,23.5 );
  
     $imagick-&gt;writeImage ("c:/wamp64/www/photo_effect/uploads/success.jpg" );
  
   ?&gt;
  </code></pre>
  
  <blockquote>
    <p>So, how do I find the proper pixel coordinates in the two images. And how do I composite both images. Also how do I rotate the image in PHP-Imagick </p>
  </blockquote>