# coding=UTF-8
import cairo
img = cairo.ImageSurface.create_from_png("sf.png")
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
img.get_width()/2, img.get_height()/2)
ctx = cairo.Context(surface)
ctx.scale(0.5, 0.5)
ctx.set_source_surface(img, 0, 0)
ctx.paint()
surface.write_to_png('sample1020a.png')
元画像(sf.png)
出力画像(sample1020a.png)

動作環境
Python2.6.1, GTK+2.16.0, pycairo1.4.12-2
関連項目
pycairoのまとめ
pycairoをWindowsにインストール
No comments:
Post a Comment