libvips/python/try2.py
John Cupitt a370e5003e vips array types are more binding-friendly
this all works now:

```python
from gi.repository import Vips

a = Vips.ArrayDouble.new([1,2,3])
a.get()

a = Vips.ArrayInt.new([1,2,3])
a.get()

a = Vips.ArrayImage.new([c, d, e])
a.get()
```
2014-08-31 10:41:53 +01:00

36 lines
615 B
Python
Executable File

#!/usr/bin/python
import logging
logging.basicConfig(level = logging.DEBUG)
from vips8 import vips
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")