# coding=UTF-8
import PythonMagick
# 上下反転
img = PythonMagick.Image("SF.JPG")
img.flip()
img.write("img2.jpg")
# 左右反転
img2 = PythonMagick.Image("SF.JPG")
img2.flop()
img2.write("img3.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