Cut To Fit?

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
vav

Post by vav »

You can find out original image sizes. So you'll be able to calculate sizes for resize operation and shifts for cropping.
monsters

Post by monsters »

yeah,

//get the width/height
$oWidth =MagickGetImageWidth($sourceWand);
$oHeight =MagickGetImageHeight($sourceWand);

//then decide what size you want to cut out
$width = $oWidth/2;
$height= $oHeight /2;

set the //x and y
$x = ($oWidth - $width) / 2
$y = ($oheight - $height) / 2

cut the image
//cropping the image
MagickCropImage( $sourceWand, (double)$width, (double)$height, (double)$x, (double)$y);
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

The -thumbnail option is basically a -resize with a -strip thrown in.

Well it does try to scale reduce very very large images faster, but you can ignore that part.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply