update magick metadata naming

IM seem to have changed their rules for naming metadata chunks. They are
now lowercase and ICM is renamed to ICC. Add a simple test too.

See https://github.com/libvips/ruby-vips/issues/246
This commit is contained in:
John Cupitt 2020-09-06 12:59:10 +01:00
parent 00096813da
commit 6b2079bfd3
4 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,6 @@
6/9/20 started 8.10.2
- update magicksave/load profile handling [kelilevi]
9/8/20 started 8.10.1
- fix markdown -> xml conversion in doc generation
- remove typedef redefinitions to please old gccs

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [8.10.1], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [8.10.2], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [10])
m4_define([vips_micro_version], [1])
m4_define([vips_micro_version], [2])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r $srcdir/ChangeLog`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=54
LIBRARY_REVISION=3
LIBRARY_REVISION=4
LIBRARY_AGE=12
# patched into include/vips/version.h

View File

@ -686,13 +686,13 @@ magick_set_vips_profile_cb( Image *image,
char name_text[256];
VipsBuf vips_name = VIPS_BUF_STATIC( name_text );
if( strcmp( name, "XMP" ) == 0 )
if( strcasecmp( name, "XMP" ) == 0 )
vips_buf_appendf( &vips_name, VIPS_META_XMP_NAME );
else if( strcmp( name, "IPTC" ) == 0 )
else if( strcasecmp( name, "IPTC" ) == 0 )
vips_buf_appendf( &vips_name, VIPS_META_IPTC_NAME );
else if( strcmp( name, "ICM" ) == 0 )
else if( strcasecmp( name, "ICC" ) == 0 )
vips_buf_appendf( &vips_name, VIPS_META_ICC_NAME );
else if( strcmp( name, "EXIF" ) == 0 )
else if( strcasecmp( name, "EXIF" ) == 0 )
vips_buf_appendf( &vips_name, VIPS_META_EXIF_NAME );
else
vips_buf_appendf( &vips_name, "magickprofile-%s", name );
@ -736,7 +736,7 @@ magick_set_magick_profile_cb( VipsImage *im,
else if( strcmp( name, VIPS_META_IPTC_NAME ) == 0 )
vips_buf_appendf( &buf, "IPTC" );
else if( strcmp( name, VIPS_META_ICC_NAME ) == 0 )
vips_buf_appendf( &buf, "ICM" );
vips_buf_appendf( &buf, "ICC" );
else if( strcmp( name, VIPS_META_EXIF_NAME ) == 0 )
vips_buf_appendf( &buf, "EXIF" );
else if( vips_isprefix( "magickprofile-", name ) )

View File

@ -580,6 +580,10 @@ class TestForeign:
assert im.width == 16
assert im.height == 16
# load should see metadata like eg. icc profiles
im = pyvips.Image.magickload(JPEG_FILE)
assert len(im.get("icc-profile-data")) == 564
# added in 8.7
@skip_if_no("magicksave")
def test_magicksave(self):
@ -597,6 +601,7 @@ class TestForeign:
assert self.colour.bands == x.bands
max_diff = (self.colour - x).abs().max()
assert max_diff < 60
assert len(x.get("icc-profile-data")) == 564
self.save_load_buffer("magicksave_buffer", "magickload_buffer",
self.colour, 60, format="JPG")