one strange issue left
This commit is contained in:
parent
180e5efe6f
commit
83cd265e7d
16
TODO
16
TODO
@ -1,15 +1,15 @@
|
||||
- try:
|
||||
|
||||
>>> from gi.repository import Vips
|
||||
>>> x = Vips.Image.new_from_file("images/IMG_4618.jpg")
|
||||
>>> x.get_value("exif-ifd0-Orientation")
|
||||
'1 (Top-left, Short, 1 components, 2 bytes)'
|
||||
>>> x.set_value("exif-ifd0-Orientation", "2")
|
||||
>>> x.write_to_file("x.jpg")
|
||||
./test_foreign.py TestForeign.test_jpeg
|
||||
|
||||
Orientation comes out as zero in vipsheader -a x.jpg
|
||||
the 2 is being lost somehow .... we set it, and can read it back,
|
||||
but when jpeg write loops over the header fields it just sees the 1
|
||||
|
||||
add a test-case for changing exif from py
|
||||
works if we use vips format
|
||||
|
||||
works if we run from python shell
|
||||
|
||||
some kind of caching issue?
|
||||
|
||||
|
||||
|
||||
|
@ -249,7 +249,7 @@ vips_exif_set_int( ExifData *ed,
|
||||
offset = component * sizeof_component;
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_exif_set_int: %s = %d\n",
|
||||
exif_tag_get_title( entry->tag ), value );
|
||||
exif_tag_get_name( entry->tag ), value );
|
||||
|
||||
if( entry->format == EXIF_FORMAT_SHORT )
|
||||
exif_set_short( entry->data + offset, bo, value );
|
||||
@ -335,7 +335,7 @@ vips_exif_set_rational( ExifData *ed,
|
||||
offset = component * sizeof_component;
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_exif_set_rational: %s = \"%s\"\n",
|
||||
exif_tag_get_title( entry->tag ), value );
|
||||
exif_tag_get_name( entry->tag ), value );
|
||||
|
||||
if( entry->format == EXIF_FORMAT_RATIONAL ) {
|
||||
ExifRational rv;
|
||||
@ -389,7 +389,7 @@ vips_exif_set_double( ExifData *ed,
|
||||
offset = component * sizeof_component;
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_exif_set_double: %s = %g\n",
|
||||
exif_tag_get_title( entry->tag ), value );
|
||||
exif_tag_get_name( entry->tag ), value );
|
||||
|
||||
if( entry->format == EXIF_FORMAT_RATIONAL ) {
|
||||
ExifRational rv;
|
||||
@ -629,7 +629,6 @@ vips_exif_image_field( VipsImage *image,
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_exif_image_field: %s = %s\n", p + 1, string );
|
||||
write_tag( ed, ifd, tag, vips_exif_set_entry, (void *) string );
|
||||
|
||||
return( NULL );
|
||||
@ -640,8 +639,7 @@ vips_exif_update( ExifData *ed, VipsImage *image )
|
||||
{
|
||||
VIPS_DEBUG_MSG( "vips_exif_update: \n" );
|
||||
|
||||
vips_image_map( image,
|
||||
vips_exif_image_field, ed );
|
||||
vips_image_map( image, vips_exif_image_field, ed );
|
||||
}
|
||||
|
||||
#endif /*HAVE_EXIF*/
|
||||
|
@ -142,6 +142,32 @@ class TestForeign(unittest.TestCase):
|
||||
self.save_load("%s.jpg", self.mono)
|
||||
self.save_load("%s.jpg", self.colour)
|
||||
|
||||
# see if we have exif parsing
|
||||
have_exif = False
|
||||
x = Vips.Image.new_from_file(self.jpeg_file)
|
||||
try:
|
||||
# our test image does have this field
|
||||
y = x.get_value("exif-ifd0-Orientation")
|
||||
have_exif = True
|
||||
except:
|
||||
pass
|
||||
|
||||
if have_exif:
|
||||
print("have exif")
|
||||
x.set_value("exif-ifd0-Orientation", "2")
|
||||
y = x.get_value("exif-ifd0-Orientation")
|
||||
print("orientation is", y)
|
||||
x.write_to_file("test.jpg")
|
||||
y = x.get_value("exif-ifd0-Orientation")
|
||||
print("orientation is", y)
|
||||
x = Vips.Image.new_from_file("test.jpg")
|
||||
y = x.get_value("exif-ifd0-Orientation")
|
||||
print("orientation is", y)
|
||||
self.assertEqual(y[0], "2")
|
||||
|
||||
os.unlink("test.jpg")
|
||||
|
||||
|
||||
def test_png(self):
|
||||
x = Vips.type_find("VipsForeign", "pngload")
|
||||
if not x.is_instantiatable():
|
||||
|
Loading…
Reference in New Issue
Block a user