exif: ensure prefix is present before parsing (#3100)
Newer Apple devices are creating EXIF without this however libexif still requires it due to JPEG/JFIF/APP1 marker heritage.
This commit is contained in:
parent
e83468e051
commit
1fc01c05e8
@ -2,6 +2,7 @@
|
|||||||
- improve rules for 16-bit heifsave [johntrunc]
|
- improve rules for 16-bit heifsave [johntrunc]
|
||||||
- improve libspng pallette write [kleisauke]
|
- improve libspng pallette write [kleisauke]
|
||||||
- improve libspng pallette sort [DarthSim]
|
- improve libspng pallette sort [DarthSim]
|
||||||
|
- ensure EXIF has prefix before parsing [lovell]
|
||||||
|
|
||||||
5/9/22 started 8.13.2
|
5/9/22 started 8.13.2
|
||||||
- in dzsave, add add missing include directive for errno/EEXIST [kleisauke]
|
- in dzsave, add add missing include directive for errno/EEXIST [kleisauke]
|
||||||
|
@ -178,7 +178,17 @@ vips_exif_load_data_without_fix( const void *data, size_t length )
|
|||||||
}
|
}
|
||||||
|
|
||||||
exif_data_unset_option( ed, EXIF_DATA_OPTION_FOLLOW_SPECIFICATION );
|
exif_data_unset_option( ed, EXIF_DATA_OPTION_FOLLOW_SPECIFICATION );
|
||||||
exif_data_load_data( ed, data, length );
|
if( !vips_isprefix( "Exif", (char *) data ) ) {
|
||||||
|
/* Ensure "Exif" prefix as loaders may not provide it.
|
||||||
|
*/
|
||||||
|
void* data_with_prefix;
|
||||||
|
data_with_prefix = g_malloc0( length + 6 );
|
||||||
|
memcpy( data_with_prefix, "Exif\0\0", 6 );
|
||||||
|
memcpy( data_with_prefix + 6, data, length );
|
||||||
|
exif_data_load_data( ed, data_with_prefix, length + 6 );
|
||||||
|
g_free( data_with_prefix );
|
||||||
|
} else
|
||||||
|
exif_data_load_data( ed, data, length );
|
||||||
|
|
||||||
return( ed );
|
return( ed );
|
||||||
}
|
}
|
||||||
@ -1391,7 +1401,7 @@ vips__exif_update( VipsImage *image )
|
|||||||
(void *) &data, &length ) )
|
(void *) &data, &length ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( !(ed = exif_data_new_from_data( data, length )) )
|
if( !(ed = vips_exif_load_data_without_fix( data, length )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1401,12 +1411,13 @@ vips__exif_update( VipsImage *image )
|
|||||||
EXIF_DATA_OPTION_FOLLOW_SPECIFICATION );
|
EXIF_DATA_OPTION_FOLLOW_SPECIFICATION );
|
||||||
exif_data_set_data_type( ed, EXIF_DATA_TYPE_COMPRESSED );
|
exif_data_set_data_type( ed, EXIF_DATA_TYPE_COMPRESSED );
|
||||||
exif_data_set_byte_order( ed, EXIF_BYTE_ORDER_INTEL );
|
exif_data_set_byte_order( ed, EXIF_BYTE_ORDER_INTEL );
|
||||||
|
|
||||||
/* Create the mandatory EXIF fields with default data.
|
|
||||||
*/
|
|
||||||
exif_data_fix( ed );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure all required fields are there before we attach the vips
|
||||||
|
* metadata.
|
||||||
|
*/
|
||||||
|
exif_data_fix( ed );
|
||||||
|
|
||||||
/* Update EXIF tags from the image metadata.
|
/* Update EXIF tags from the image metadata.
|
||||||
*/
|
*/
|
||||||
vips_exif_update( ed, image );
|
vips_exif_update( ed, image );
|
||||||
|
Loading…
Reference in New Issue
Block a user