setting EXIF data blocks sets other tags too

calling vips_image_set() to set the EXIF data block VIPS_META_EXIF_NAME
will automaticaly set other tags, like orientation etc.
This commit is contained in:
John Cupitt 2017-11-27 15:15:21 +00:00
parent 6013962288
commit 9c8790b40a
8 changed files with 16 additions and 12 deletions

View File

@ -40,6 +40,7 @@
- add gif-delay, gif-comment and gif-loop metadata
- add dispose handling to gifload
- deprecate the "centre" option for vips_resize(): it's now always on
- setting the EXIF data block automatically sets other image tags
29/8/17 started 8.5.9
- make --fail stop jpeg read on any libjpeg warning, thanks @mceachen

View File

@ -484,7 +484,7 @@ vips__exif_parse( VipsImage *image )
return( -1 );
}
/* Make sure all required fields are there before we attach to vips
/* Make sure all required fields are there before we attach the vips
* metadata.
*/
exif_data_fix( ed );

View File

@ -514,9 +514,6 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
(VipsCallbackFn) vips_free, data, data_length );
}
if( vips__exif_parse( out ) )
return( -1 );
/* Tell downstream we are reading sequentially.
*/
vips_image_set_area( out, VIPS_META_SEQUENTIAL, NULL, NULL );

View File

@ -239,9 +239,6 @@ int vips__openslide_read( const char *filename, VipsImage *out,
int vips__openslide_read_associated( const char *filename, VipsImage *out,
const char *associated );
int vips__exif_parse( VipsImage *image );
int vips__exif_update( VipsImage *image );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -53,6 +53,7 @@
#include <string.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "pforeign.h"

View File

@ -269,11 +269,6 @@ read_header( Read *read, VipsImage *out )
}
WebPMuxDelete( mux );
/* We may have read some exif ... parse into the header.
*/
if( vips__exif_parse( out ) )
return( -1 );
}
#endif /*HAVE_LIBWEBPMUX*/

View File

@ -52,6 +52,9 @@ typedef struct _VipsMeta {
GValue value; /* copy of value */
} VipsMeta;
int vips__exif_parse( VipsImage *image );
int vips__exif_update( VipsImage *image );
void vips_check_init( void );
void vips__meta_init_types( void );

View File

@ -962,6 +962,16 @@ vips_image_set( VipsImage *image, const char *name, GValue *value )
meta_init( image );
(void) meta_new( image, name, value );
/* If we're setting an EXIF data block, we need to automatically expand
* out all the tags. This will set things like xres/yres too.
*
* We do this herfe rather than in meta_new() since we don't want to
* trigger on copy_fields.
*/
if( strcmp( name, VIPS_META_EXIF_NAME ) == 0 )
if( vips__exif_parse( image ) )
g_warning( "image_set: bad exif data" );
#ifdef DEBUG
meta_sanity( image );
#endif /*DEBUG*/