Imagickでサムネイル画像を作ってみました。質問を簡単にするために、次のテストコードがあります。
//loading picture
$image = new Imagick('/home/ytg/temp/blank.png');
//checking image size
echo "width: {$image->getimagewidth()}\n";
echo "height: {$image->getimageheight()}\n";
//creating thumbnail
$image->thumbnailImage(220, 220, true);
//checking image size
echo "new width: {$image->getimagewidth()}\n";
echo "new height: {$image->getimageheight()}\n";
次の結果が得られます。
width: 300
height: 300
new width: 219
new height: 220
サムネイル画像の幅を 1 ピクセル小さくするのはなぜですか? どうすればこれを防ぐことができますか? 入力画像の幅と高さが常に同じであるとは限らず、そのような場合にサムネイルを埋めたくないので、の最後の$fill
パラメーターを使用したくありません。thumbnailImage()
( PHP Version => 5.4.6-1ubuntu1.1; imagick module version => 3.1.0RC1
)