<?php
  $im = new \Imagick();
        $im->readImage($_SERVER['DOCUMENT_ROOT']."/path/toimage/".$inputfront);
        
        $im->setImageBackgroundColor(new \ImagickPixel('transparent')); $controlPoints = array( 0,0,
            280,0,
            994,0,
            914,50,
            994,862,
            784,842,
            0,862,
            110,762);
        $im->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);
        $output_front_distort="Projects/path/where you want to store image/distorted_book.png";
    
       header("Content-Type: image/png");
        $im->writeImage($_SERVER['DOCUMENT_ROOT']."/designerr/public/".$output_front_distort);
?>