libvips/python/example/try2.py
John Cupitt 6e94df7214 set version before import pyvips8
stops some warnings
2016-05-18 13:41:41 +01:00

36 lines
635 B
Python
Executable File

#!/usr/bin/python
import logging
logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
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")