metadata was not being saved to vips files
broken by the rewind changes a few weeks ago added a test too
This commit is contained in:
parent
36331739ab
commit
98e80903e0
18
TODO
18
TODO
@ -1,3 +1,21 @@
|
|||||||
|
- extra character in exif-data?
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
$ cd test
|
||||||
|
$ vipsheader -a images/IMG_4618.jpg | grep exif-data
|
||||||
|
exif-data: VIPS_TYPE_BLOB, data = 0x16e0a20, length = 6626
|
||||||
|
$ vips copy images/IMG_4618.jpg x.v
|
||||||
|
$ vipsheader -a x.v | grep exif-data
|
||||||
|
exif-data: VIPS_TYPE_BLOB, data = 0x20679f0, length = 6627
|
||||||
|
|
||||||
|
one byte longer!
|
||||||
|
|
||||||
|
fix, and add a test for exif length to test/test_foreign.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- how about something like vips_grid() which turns a tall thin one-band
|
- how about something like vips_grid() which turns a tall thin one-band
|
||||||
image into a much smaller many-band image?
|
image into a much smaller many-band image?
|
||||||
|
|
||||||
|
@ -704,6 +704,9 @@ vips_image_generate( VipsImage *image,
|
|||||||
VIPS_DEBUG_MSG( "vips_image_generate: "
|
VIPS_DEBUG_MSG( "vips_image_generate: "
|
||||||
"attaching partial callbacks\n" );
|
"attaching partial callbacks\n" );
|
||||||
|
|
||||||
|
if( vips_image_written( image ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIPS_IMAGE_SETBUF:
|
case VIPS_IMAGE_SETBUF:
|
||||||
@ -742,6 +745,11 @@ vips_image_generate( VipsImage *image,
|
|||||||
if( res )
|
if( res )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
/* Must come before we rewind.
|
||||||
|
*/
|
||||||
|
if( vips_image_written( image ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
/* We've written to image ... rewind it ready for reading.
|
/* We've written to image ... rewind it ready for reading.
|
||||||
*/
|
*/
|
||||||
if( vips_image_pio_input( image ) )
|
if( vips_image_pio_input( image ) )
|
||||||
@ -759,8 +767,5 @@ vips_image_generate( VipsImage *image,
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_image_written( image ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,21 @@ class TestForeign(unittest.TestCase):
|
|||||||
self.assertEqual(im.bands, x.bands)
|
self.assertEqual(im.bands, x.bands)
|
||||||
self.assertLessEqual((im - x).abs().max(), max_diff)
|
self.assertLessEqual((im - x).abs().max(), max_diff)
|
||||||
|
|
||||||
|
def test_vips(self):
|
||||||
|
self.save_load_file("test.v", "", self.colour, 0)
|
||||||
|
|
||||||
|
# check we can save and restore metadata
|
||||||
|
self.colour.write_to_file("test.v")
|
||||||
|
x = Vips.Image.new_from_file("test.v")
|
||||||
|
before_exif = self.colour.get_value("exif-data")
|
||||||
|
after_exif = x.get_value("exif-data")
|
||||||
|
|
||||||
|
for i in range(len(before_exif)):
|
||||||
|
self.assertEqual(before_exif[i], after_exif[i])
|
||||||
|
|
||||||
|
x = None
|
||||||
|
os.unlink("test.v")
|
||||||
|
|
||||||
def test_jpeg(self):
|
def test_jpeg(self):
|
||||||
x = Vips.type_find("VipsForeign", "jpegload")
|
x = Vips.type_find("VipsForeign", "jpegload")
|
||||||
if not x.is_instantiatable():
|
if not x.is_instantiatable():
|
||||||
|
Loading…
Reference in New Issue
Block a user