how to divide image into three equal parts in php imagemagick and combine with some padding and output as single image -
i want display image 3 parts triptych of imagemagick php library. saw same example here
http://www.rubbleimages.com/canvas.php.
can me on issue please
i hopeless @ php seems work me:
#!/usr/local/bin/php -f <?php $padding=10; $info = getimagesize("input.jpg"); $width=$info[0]; $height=$info[1]; // calculate dimensions of output image $canvaswidth=$width+4*$padding; $canvasheight=$height+2*$padding; // create white canvas $output = imagecreatetruecolor($canvaswidth, $canvasheight); $background = imagecolorallocate($output, 255, 255, 255); imagefill($output, 0, 0, $background); // read in original image $orig = imagecreatefromjpeg("input.jpg"); // copy left third output image imagecopy($output, $orig,$padding, $padding, 0, 0, $width/3, $height); // copy central third output image imagecopy($output, $orig,2*$padding+$width/3, $padding, $width/3, 0, $width/3, $height); // copy right third output image imagecopy($output, $orig,3*$padding+2*$width/3,$padding, 2*$width/3, 0, $width/3, $height); // save output image imagejpeg($output,"result.jpg"); ?>
if start this:
i result
i added black outline afterwards can see extent of image.
Comments
Post a Comment