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