pyvips8 can create new metadata

previously it tried to lookup the type of the field in set(), now if
OK if there's no field there already
This commit is contained in:
John Cupitt 2016-06-17 11:27:13 +01:00
parent d56cd4dcb2
commit 11b136b2df
3 changed files with 13 additions and 16 deletions

View File

@ -25,6 +25,7 @@
- VImage::ifthenelse() with double args was missing =0 on options
- better accuracy for reducev with smarter multiplication
- better quality for vips_resize() with linear/cubic kernels
- pyvips8 can create new metadata
18/5/16 started 8.3.2
- more robust vips image reading

6
TODO
View File

@ -1,9 +1,3 @@
- python can't set new metadata, it can only set existing metadata
im.set_value("banana", 12)
will fail as Vips.py tries to look up the type of "banana"
- add more webp tests to py suite
- try moving some more of the CLI tests to py

View File

@ -872,18 +872,20 @@ class Image(Vips.Image):
logger.debug('%s.%s = %s' % (self, field, value))
logger.debug('%s.%s needs a %s' % (self, field, gtype))
# blob-ize
if GObject.type_is_a(gtype, vips_type_blob):
if not isinstance(value, Vips.Blob):
value = Vips.Blob.new(None, value)
# there must be a better way to test for GType(0)
if gtype.name != 'invalid':
# blob-ize
if GObject.type_is_a(gtype, vips_type_blob):
if not isinstance(value, Vips.Blob):
value = Vips.Blob.new(None, value)
# image-ize
if GObject.type_is_a(gtype, vips_type_image):
if not isinstance(value, Vips.Image):
value = imageize(self, value)
# image-ize
if GObject.type_is_a(gtype, vips_type_image):
if not isinstance(value, Vips.Image):
value = imageize(self, value)
# array-ize some types, if necessary
value = arrayize(gtype, value)
# array-ize some types, if necessary
value = arrayize(gtype, value)
self.set(field, value)