From 23a16360159d5ab9b846d8f258f66de2b5e184f4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 30 Aug 2019 12:20:12 +0100 Subject: [PATCH 1/4] fix build with no IM we had a stray ImageInfo --- libvips/foreign/magick.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libvips/foreign/magick.c b/libvips/foreign/magick.c index 5d1312e9..254da73c 100644 --- a/libvips/foreign/magick.c +++ b/libvips/foreign/magick.c @@ -48,6 +48,8 @@ #include "pforeign.h" #include "magick.h" +#if defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7) + /* ImageMagick can't detect some formats, like ICO, by examining the contents -- * ico.c simply does not have a recogniser. * @@ -88,6 +90,8 @@ magick_sniff_file( ImageInfo *image_info, const char *filename ) magick_sniff_bytes( image_info, bytes, 256 ); } +#endif /*defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)*/ + #ifdef HAVE_MAGICK7 Image * From 574be4380ec1429a5b41acd01ecd1dec87ae16e8 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 31 Aug 2019 11:29:36 +0100 Subject: [PATCH 2/4] revert sharpen restoring the input colourspace icc_export can make _RGB images, so the input can be outside the set of supported colourspace transforms. See https://github.com/libvips/libvips/commit/46212e92b1f943e6852e807db1ee6e5ca66b6ccf#r34904985 bump version too. --- ChangeLog | 3 +++ configure.ac | 6 +++--- libvips/convolution/sharpen.c | 11 ++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 925eb6ff..6c6c21c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +31/8/19 started 8.8.3 +- revert sharpen restoring the input colourspace + 9/7/19 started 8.8.2 - better early shutdown in readers - don't attempt to save large XMP to jpeg [tnextday] diff --git a/configure.ac b/configure.ac index 8f636916..19e87735 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [8.8.2], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [8.8.3], [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], [8]) -m4_define([vips_micro_version], [2]) +m4_define([vips_micro_version], [3]) 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 ChangeLog` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=53 -LIBRARY_REVISION=1 +LIBRARY_REVISION=2 LIBRARY_AGE=11 # patched into include/vips/version.h diff --git a/libvips/convolution/sharpen.c b/libvips/convolution/sharpen.c index 38df2e48..214d52ee 100644 --- a/libvips/convolution/sharpen.c +++ b/libvips/convolution/sharpen.c @@ -41,7 +41,6 @@ * - move to defaults suitable for screen output * 28/8/19 * - fix sigma 0.5 case (thanks 2h4dl) - * - restore input colourspace */ /* @@ -178,7 +177,6 @@ vips_sharpen_build( VipsObject *object ) VipsImage *in; int i; - VipsInterpretation old_interpretation; VIPS_GATE_START( "vips_sharpen_build: build" ); @@ -194,7 +192,6 @@ vips_sharpen_build( VipsObject *object ) in = sharpen->in; - old_interpretation = in->Type; if( vips_colourspace( in, &t[0], VIPS_INTERPRETATION_LABS, NULL ) ) return( -1 ); in = t[0]; @@ -274,9 +271,6 @@ vips_sharpen_build( VipsObject *object ) NULL ) ) return( -1 ); - /* Set demand hints. FATSTRIP is good for us, as THINSTRIP will cause - * too many recalculations on overlaps. - */ t[5] = vips_image_new(); if( vips_image_pipeline_array( t[5], VIPS_DEMAND_STYLE_FATSTRIP, args ) ) @@ -289,11 +283,10 @@ vips_sharpen_build( VipsObject *object ) g_object_set( object, "out", vips_image_new(), NULL ); - /* Reattach the rest, back to the start colourspace. + /* Reattach the rest. */ if( vips_bandjoin2( t[5], t[3], &t[6], NULL ) || - vips_colourspace( t[6], &t[7], old_interpretation, NULL ) || - vips_image_write( t[7], sharpen->out ) ) + vips_image_write( t[6], sharpen->out ) ) return( -1 ); VIPS_GATE_STOP( "vips_sharpen_build: build" ); From 06fdc950381f6ceb86e6784890a9d9754a8a6dbb Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 4 Sep 2019 17:02:24 +0100 Subject: [PATCH 3/4] xres/yres params in tiffsave were in cm and should have been in pixels/mm thanks f--f see https://github.com/libvips/libvips/issues/1421 --- ChangeLog | 1 + libvips/foreign/tiffsave.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c6c21c7..c9e05a6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 31/8/19 started 8.8.3 - revert sharpen restoring the input colourspace +- xres/yres tiffsave params were in pixels/cm [f--f] 9/7/19 started 8.8.2 - better early shutdown in readers diff --git a/libvips/foreign/tiffsave.c b/libvips/foreign/tiffsave.c index d9d76124..3ee69972 100644 --- a/libvips/foreign/tiffsave.c +++ b/libvips/foreign/tiffsave.c @@ -14,6 +14,8 @@ * - predictor defaults to horizontal, reducing file size, usually * 13/6/18 * - add region_shrink + * 4/9/18 [f--f] + * - xres/yres params were in pixels/cm */ /* @@ -137,16 +139,22 @@ vips_foreign_save_tiff_build( VipsObject *object ) build( object ) ) return( -1 ); - /* Default xres/yres to the values from the image. + /* Default xres/yres to the values from the image. This is always + * pixels/mm. */ if( !vips_object_argument_isset( object, "xres" ) ) - tiff->xres = save->ready->Xres * 10.0; + tiff->xres = save->ready->Xres; if( !vips_object_argument_isset( object, "yres" ) ) - tiff->yres = save->ready->Yres * 10.0; + tiff->yres = save->ready->Yres; + + /* We default to pixels/cm. + */ + tiff->xres *= 10.0; + tiff->yres *= 10.0; /* resunit param overrides resunit metadata. */ - if( !vips_object_argument_isset( object, "resunit" ) && + if( vips_object_argument_isset( object, "resunit" ) && vips_image_get_typeof( save->ready, VIPS_META_RESOLUTION_UNIT ) && !vips_image_get_string( save->ready, From f80c7a181039517d005241444ccef43e87923e3c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 5 Sep 2019 12:39:56 +0100 Subject: [PATCH 4/4] add tests for xres/yres in tiffsave --- test/test-suite/test_foreign.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test-suite/test_foreign.py b/test/test-suite/test_foreign.py index 0ef1e2b6..51648d49 100644 --- a/test/test-suite/test_foreign.py +++ b/test/test-suite/test_foreign.py @@ -321,6 +321,24 @@ class TestForeign: assert x1.width == x2.height assert x1.height == x2.width + filename = temp_filename(self.tempdir, '.tif') + x = pyvips.Image.new_from_file(TIF_FILE) + x = x.copy() + x.write_to_file(filename, xres=100, yres=200, resunit="cm") + x1 = pyvips.Image.new_from_file(filename) + assert x1.get("resolution-unit") == "cm" + assert x1.xres == 100 + assert x1.yres == 200 + + filename = temp_filename(self.tempdir, '.tif') + x = pyvips.Image.new_from_file(TIF_FILE) + x = x.copy() + x.write_to_file(filename, xres=100, yres=200, resunit="inch") + x1 = pyvips.Image.new_from_file(filename) + assert x1.get("resolution-unit") == "in" + assert x1.xres == 100 + assert x1.yres == 200 + # OME support in 8.5 x = pyvips.Image.new_from_file(OME_FILE) assert x.width == 439