more compat for older IPCT code
add IPTC data under the name "ipct-data" as well
This commit is contained in:
parent
77287a938f
commit
83e36880da
@ -471,10 +471,19 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
|
|||||||
/* Possible IPTC data block.
|
/* Possible IPTC data block.
|
||||||
*/
|
*/
|
||||||
if( p->data_length > 5 &&
|
if( p->data_length > 5 &&
|
||||||
vips_isprefix( "Photo", (char *) p->data ) &&
|
vips_isprefix( "Photo", (char *) p->data ) ) {
|
||||||
attach_blob( out, VIPS_META_IPTC_NAME,
|
if( attach_blob( out, VIPS_META_IPTC_NAME,
|
||||||
p->data, p->data_length ) )
|
p->data, p->data_length ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
/* Older versions of libvips used this misspelt
|
||||||
|
* name :-( attach under this name too for
|
||||||
|
* compatibility.
|
||||||
|
*/
|
||||||
|
if( attach_blob( out, "ipct-data",
|
||||||
|
p->data, p->data_length ) )
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1291,8 +1291,7 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out )
|
|||||||
data_length ) {
|
data_length ) {
|
||||||
void *data_copy;
|
void *data_copy;
|
||||||
|
|
||||||
/* For no very good reason, libtiff stores IPTC as an array of
|
/* libtiff stores IPTC as an array of long, not byte.
|
||||||
* long, not byte.
|
|
||||||
*/
|
*/
|
||||||
data_length *= 4;
|
data_length *= 4;
|
||||||
|
|
||||||
@ -1301,6 +1300,15 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out )
|
|||||||
memcpy( data_copy, data, data_length );
|
memcpy( data_copy, data, data_length );
|
||||||
vips_image_set_blob( out, VIPS_META_IPTC_NAME,
|
vips_image_set_blob( out, VIPS_META_IPTC_NAME,
|
||||||
(VipsCallbackFn) vips_free, data_copy, data_length );
|
(VipsCallbackFn) vips_free, data_copy, data_length );
|
||||||
|
|
||||||
|
/* Older versions of libvips used this misspelt name :-( attach
|
||||||
|
* under this name too for compatibility.
|
||||||
|
*/
|
||||||
|
if( !(data_copy = vips_malloc( NULL, data_length )) )
|
||||||
|
return( -1 );
|
||||||
|
memcpy( data_copy, data, data_length );
|
||||||
|
vips_image_set_blob( out, "ipct-data",
|
||||||
|
(VipsCallbackFn) vips_free, data_copy, data_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read any photoshop metadata.
|
/* Read any photoshop metadata.
|
||||||
|
Loading…
Reference in New Issue
Block a user