Imagemagick Campaign Not Working
I was trying to crop an image using imagemagick. This did not produce the expected results. I decided to set the crop value to 0 to try and find the error. With a crop value of 0, the image is still cropped.
Here is the code:
$img = new Imagick();
$img->readImage("{german-grammar.pdf}[17]");
$img->trimImage(10);
$width = $img->getImageWidth();
$height= $img->getImageHeight();
$img->setImagePage($width,$height, 0, 0); //Solution
$img->cropImage($width, $height,0,0); //Original Problem lime
$img->setImagePage(0,0,0,0);
$img->writeImage($ImagesPath.$ImageName);
The input is a PDF file.
I would be grateful if anyone could tell me what I am doing wrong. Of course, a yield value of 0 should not be clipped at all.
Thank!
Cymro
source to share
I think you need to change the image right after trimImage()
and before cropImage()
. It is generally a good idea to display the image after any changes to its geometry (such as cropping and resizing), if you want the image to forget that it was once part of a larger image and go out into the world happy and content. its own new shape and size.
source to share