(PECL imagick 2 >= 2.3.0, PECL imagick 3 >= 3.3.0)
Imagick::deskewImage — 傾きを除去する
このメソッドを使うと、スキャナでの読み込み時にうまく紙を置かなかった場合などの画像の傾きを除去することができます。 このメソッドは、ImageMagick バージョン 6.4.5 以降で Imagick をコンパイルした場合に使用可能です。
threshold
傾き除去の閾値。
例1 Imagick::deskewImage()
<?php
function deskewImage($threshold) {
$imagick = new \Imagick(realpath("images/NYTimes-Page1-11-11-1918.jpg"));
$deskewImagick = clone $imagick;
//This is the only thing required for deskewing.
$deskewImagick->deskewImage($threshold);
//The rest of this example is to make the result obvious - because