better exif write

only remove exif fields not on the image if we made the exif from the saved exif data on the image
This commit is contained in:
John Cupitt 2017-11-27 05:54:10 +00:00
parent de7636c66b
commit 6013962288

View File

@ -1002,19 +1002,22 @@ vips_exif_update( ExifData *ed, VipsImage *image )
VIPS_DEBUG_MSG( "vips_exif_update: \n" );
/* Walk the image and update any stuff that's been changed in image
* metadata.
/* Walk the image and add any exif- that's set in image metadata.
*/
vips_image_map( image, vips_exif_image_field, ed );
/* Walk the exif and look for any fields which are NOT in image
* metadata. They must have been removed ... remove them from exif as
* well.
/* If this exif came from the image (rather than being an exif block we
* have made afresh), then any fields which are in the block but not on
* the image must have been deliberately removed. Remove them from the
* block as well.
*/
ve.image = image;
ve.ed = ed;
exif_data_foreach_content( ed,
(ExifDataForeachContentFunc) vips_exif_exif_content, &ve );
if( vips_image_get_typeof( image, VIPS_META_EXIF_NAME ) ) {
ve.image = image;
ve.ed = ed;
exif_data_foreach_content( ed,
(ExifDataForeachContentFunc) vips_exif_exif_content,
&ve );
}
}
/* Examine the metadata tags on the image and update the EXIF block.