from pgmagick.api import Image
img = Image((300, 200), 'red')
img.write('bg-red.jpg')
from pgmagick.api import Image
img = Image((300, 200), 'transparent')
img.write('transparent.png')
from pgmagick.api import Image
img = Image((300, 200), 'gradient:#ffffff-#000000')
img.write('gradient.png')
from pgmagick.api import Image
img = Image((300, 200))
img.annotate('Hello World')
img.write('helloworld.png')
斜め45度に傾いた文字を描く draw text of rotated 45 degrees ——————————-
from pgmagick.api import Image
img = Image((300, 200))
img.annotate('Hello World', angle=45)
img.write('helloworld45.png')
# coding: utf-8
from pgmagick.api import Image
img = Image((300, 200))
img.font("/usr/share/fonts/truetype/ttf-japanese-gothic.ttf")
img.annotate('Hello World')
img.annotate('ようこそpgmagickへ!!')
img.write('japanese-text.png')
from pgmagick.api import Image
img = Image('gradient.png')
img.scale(0.5)
img.write('halfscale.png')
from pgmagick.api import Image
img = Image('gradient.png')
img.scale((150, 100), 'lanczos')
img.write('halfscale2.png')
from pgmagick import Image, Blob
img = Image(Blob(open('lena_std.jpg').read()), Geometry(200, 200))
img.scale('200x200')
img.write('lena_scale.jpg')
from pgmagick.api import Image
img = Image((300, 200))
print img.columns(), img.rows()
print img.width, img.height
$ python size.py
300 200
300 200
from pgmagick.api import Image
img = Image('lena.jpg')
img.sharpen(1)
img.write('lena_sharpen1.jpg')
from pgmagick.api import Image
img = Image('lena.jpg')
img.blur(10, 5)
img.write('lena_blur.jpg')
from pgmagick.api import Image
img = Image('lena.jpg')
img.edge(2)
img.write('lena_edge.jpg')
import sys
from pgmagick import Image, Blob
blob = Blob()
img = Image('exif-sample.jpg')
img.profile("*", blob)
img.write('exif-strip.jpg')