libvips/python/test_gobject.py

27 lines
535 B
Python
Raw Normal View History

#!/usr/bin/python
import gc
import sys
2011-06-22 14:17:16 +02:00
# you might need this in your .bashrc
# export GI_TYPELIB_PATH=$VIPSHOME/lib/girepository-1.0
from gi.repository import Vips
2011-06-22 14:17:16 +02:00
a = Vips.Image()
a.props.filename = sys.argv[1]
a.props.mode = 'r'
if a.build() != 0:
print Vips.error_buffer()
sys.exit(-1)
2011-06-22 14:17:16 +02:00
print 'a.get_width() =', a.get_width()
print 'a.props.width =', a.props.width
2011-06-22 14:17:16 +02:00
print 'starting shutdown ...'
del a
# sometimes have to do several GCs to get them all, not sure why
for i in range(10):
gc.collect ()
print 'shutdown!'