# coding=UTF-8
import PythonMagick
# 上40ピクセルを切り落とす
img = PythonMagick.Image("SF.JPG")
img.chop(PythonMagick._PythonMagick.Geometry(0, 40))
img.write("img11a.jpg")
# 下40ピクセルを切り落とす
img = PythonMagick.Image("SF.JPG")
img.chop(PythonMagick._PythonMagick.Geometry("0x40+0+160"))
img.write("img11b.jpg")
元画像
出力画像1

出力画像2

※ubuntuでPythonMagickをインストールするには、以下のコマンドを実行します。
sudo apt-get install python-pythonmagick
動作環境
python 2.6.6, python-pythonmagick 0.9.1
No comments:
Post a Comment