add XMP read to heifload
This commit is contained in:
parent
ed7c6b9fd4
commit
472f9da0ad
|
@ -250,13 +250,6 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
char name[256];
|
char name[256];
|
||||||
|
|
||||||
/* exif has a special name.
|
|
||||||
*/
|
|
||||||
if( strcasecmp( type, "exif" ) == 0 )
|
|
||||||
vips_snprintf( name, 256, VIPS_META_EXIF_NAME );
|
|
||||||
else
|
|
||||||
vips_snprintf( name, 256, "heif-%s-%d", type, i );
|
|
||||||
|
|
||||||
printf( "metadata type = %s, length = %zd\n", type, length );
|
printf( "metadata type = %s, length = %zd\n", type, length );
|
||||||
|
|
||||||
if( !(data = VIPS_ARRAY( out, length, unsigned char )) )
|
if( !(data = VIPS_ARRAY( out, length, unsigned char )) )
|
||||||
|
@ -276,6 +269,19 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||||
length -= 4;
|
length -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* exif has a special name.
|
||||||
|
*
|
||||||
|
* XMP metadata is just attached with the "mime" type, and
|
||||||
|
* usually start with "<x:xmpmeta".
|
||||||
|
*/
|
||||||
|
if( strcasecmp( type, "exif" ) == 0 )
|
||||||
|
vips_snprintf( name, 256, VIPS_META_EXIF_NAME );
|
||||||
|
else if( strcasecmp( type, "mime" ) == 0 &&
|
||||||
|
vips_isprefix( "<x:xmpmeta", (const char *) data ) )
|
||||||
|
snprintf( name, 256, VIPS_META_XMP_NAME );
|
||||||
|
else
|
||||||
|
vips_snprintf( name, 256, "heif-%s-%d", type, i );
|
||||||
|
|
||||||
vips_image_set_blob( out, name,
|
vips_image_set_blob( out, name,
|
||||||
(VipsCallbackFn) NULL, data, length );
|
(VipsCallbackFn) NULL, data, length );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue