Title: [Plugin: ImageMagick Engine]  Crop with cut?
Last modified: August 20, 2016

---

# [Plugin: ImageMagick Engine] Crop with cut?

 *  [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/)
 * First, thanks for this nice and powerful plugin!
 * When using default WP, I have the option to have the thumbnails cropped exactly,
   cutting in part of the image if necessary. But this plugin does not crop the 
   images that way, it resizes them smaller and adds white fields. How to achieve
   the cropping with cutting as per WP? (tweaking code is fine with me).
    Cheers,
 * [http://wordpress.org/extend/plugins/imagemagick-engine/](http://wordpress.org/extend/plugins/imagemagick-engine/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209338)
 * Okay, after some debugging and googling, it become clear this is actually a bug.
   Crop works as expected (cutting to fill) but not in Windows. The reason is the
   pertinent flag that’s already there needs to be additionally escaped to make 
   it work on Win.
 * in `imagemagick-engine.php li ~502` add this line:
 *     ```
       if ($crop) {
       	//[alx359]. Added. Escape as ^^, to ensure the geometry option flag works on Windows
       	//ref: http://www.imagemagick.org/Usage/resize/#fill
       	if(PHP_SHLIB_SUFFIX == 'dll') $cmd .= "^";
   
       	$cmd .= "^ -gravity center -extent {$width}x{$height}";
       }
       else
       	$cmd .= "!"; // force these dimensions
       ```
   
 *  Plugin Contributor [Orangelab](https://wordpress.org/support/users/orangelab/)
 * (@orangelab)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209371)
 * Thanks for the detailed report!
 * I’ve reworked the fix slightly (move OS test to a separate function), and will
   release once I’ve gotten some confirmation that it works. It is currently available
   as the development version ([http://downloads.wordpress.org/plugin/imagemagick-engine.zip](http://downloads.wordpress.org/plugin/imagemagick-engine.zip)).
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209372)
 * It works, but not as expected.
 * The beta:
    – The path option is giving me now a red cross. Was green and working
   in the stable. – ‘ImageMagick PHP module’ says check-green, but when saving config
   as this, it doesn’t work [visually, ‘regenerating images’ progress bar stucks
   at 0% and doesn’t move]. – Saving as command-line (even if red-marked) it starts
   working and renders fine. But the state of ‘Image engine’ dropdown, visually 
   switches back to ‘ImageMagick PHP module’, so it’s confusing what’s actually 
   going on.
 * The stable:
    – The command-line option is check-green for me. When saved as this,
   it remembers state and works fine with the fix. – The ‘ImageMagick PHP module’
   option also shows check-green, but it doesn’t work for me [Win7].
 *  Plugin Contributor [Orangelab](https://wordpress.org/support/users/orangelab/)
 * (@orangelab)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209385)
 * Thanks for testing! I might have to set up a Windows test environment if this
   keeps up…
 * The command line handling should be fixed in new beta (-beta2) which should be
   available as development version here in a few minutes.
 * As for the Imagick module errors: it probably means you do not have all required
   image format libraries installed, or at least that the php module cannot find
   them.
 * I’ve been meaning to test for this, so if you’re able to help out I might have
   a version to test later.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209391)
 * The command-line issue is fixed now. Thanks very much!
 * The ‘PHP module’ is still not working for me, but most probably you’re right.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: ImageMagick Engine] Crop with cut?’ is closed to new replies.

 * ![](https://ps.w.org/imagemagick-engine/assets/icon-256x256.jpg?rev=2244640)
 * [ImageMagick Engine](https://wordpress.org/plugins/imagemagick-engine/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/imagemagick-engine/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/imagemagick-engine/)
 * [Active Topics](https://wordpress.org/support/plugin/imagemagick-engine/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/imagemagick-engine/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/imagemagick-engine/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [alx359](https://wordpress.org/support/users/alx359/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-imagemagick-engine-default-crop/#post-2209391)
 * Status: not resolved