libvips/python/example/try2.py
John Cupitt 6fb967ac3b more py tweaks
fast startup, reorganised python/
2014-10-14 10:17:33 +01:00

34 lines
591 B
Python
Executable File

#!/usr/bin/python
import logging
logging.basicConfig(level = logging.DEBUG)
from gi.repository import Vips
Vips.cache_set_trace(True)
try:
a = Vips.Image.new_from_file("/home/john/pics/babe.poop")
except Vips.Error, e:
print e
a = Vips.Image.new_from_file("/home/john/pics/babe.jpg")
b = Vips.Image.new_from_file("/home/john/pics/k2.jpg")
print 'a =', a
print 'b =', b
out = Vips.call("add", a, b)
print 'out =', out
out = a.add(b)
print 'out =', out
ones = Vips.ArrayDouble.new([1])
twos = Vips.ArrayDouble.new([2])
out = out.linear(ones, twos)
out.write_to_file("x.v")