From fdaad16407c276a525c87971a82294796874a017 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Nov 2012 12:51:58 +0000 Subject: [PATCH 1/6] better --help output for vips driver prog now lists possible actions --- ChangeLog | 3 ++- TODO | 16 ++++++++++++++++ tools/vips.c | 42 +++++++++++++++++++++++++++++++++++------- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1833205..2c07f4b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,7 +17,8 @@ - dzsave --layout google has a @background option - dzsave has a --depth option - update for new glib threading API -- remove no threads option +- remove no threads option, glib no longer support it +- better --help output for vips driver prog 2/10/12 started 7.30.4 - remove options from format string in .dzi (thanks Martin) diff --git a/TODO b/TODO index 733b1fb9..8d8d1f08 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,19 @@ + +- have a web page with a list of the python member names + + $ vips cpph all | grep join + VImage bandjoin( VImage bandjoin_in2 ) throw( VError ); + static VImage + gbandjoin( std::vector gbandjoin_in ) throw( VError ); + VImage lrjoin( VImage lrjoin_in2 ) throw( VError ); + VImage tbjoin( VImage tbjoin_in2 ) throw( VError ); + + could generate some docs too? + + perhaps it should be part of vips.c + + + - quadratic doesn't work for order 3 start to get jaggies on lines --- the 3rd differential isn't being diff --git a/tools/vips.c b/tools/vips.c index 0176f63a..6f76749e 100644 --- a/tools/vips.c +++ b/tools/vips.c @@ -905,6 +905,20 @@ print_cppdefs( int argc, char **argv ) return( 0 ); } +static void action_list( VipsBuf *buf ); + +static int +print_help( int argc, char **argv ) +{ + char txt[1024]; + VipsBuf buf = VIPS_BUF_STATIC( txt ); + + action_list( &buf ); + printf( "%s", vips_buf_all( &buf ) ); + + return( 0 ); +} + /* All our built-in actions. */ @@ -930,11 +944,28 @@ static ActionEntry actions[] = { &empty_options[0], print_cppdefs }, { "links", N_( "generate links for vips/bin" ), &empty_options[0], print_links }, + { "help", N_( "list possible actions" ), + &empty_options[0], print_help }, }; +static void +action_list( VipsBuf *buf ) +{ + int i; + + vips_buf_appends( buf, _( "possible actions:\n" ) ); + for( i = 0; i < VIPS_NUMBER( actions ); i++ ) + vips_buf_appendf( buf, "%7s - %s\n", + actions[i].name, _( actions[i].description ) ); + vips_buf_appendf( buf, "%7s - %s\n", + "OP", _( "execute vips operation OP" ) ); +} + static void parse_options( GOptionContext *context, int *argc, char **argv ) { + char txt[1024]; + VipsBuf buf = VIPS_BUF_STATIC( txt ); GError *error = NULL; int i, j; @@ -944,6 +975,9 @@ parse_options( GOptionContext *context, int *argc, char **argv ) printf( "%d) %s\n", i, argv[i] ); #endif /*DEBUG*/ + action_list( &buf ); + g_option_context_set_summary( context, vips_buf_all( &buf ) ); + if( !g_option_context_parse( context, argc, &argv, &error ) ) { if( error ) { fprintf( stderr, "%s\n", error->message ); @@ -1128,13 +1162,7 @@ main( int argc, char **argv ) if( action && !handled ) { - printf( "%s", _( "possible actions:\n" ) ); - for( i = 0; i < VIPS_NUMBER( actions ); i++ ) - printf( "%10s - %s\n", - actions[i].name, _( actions[i].description ) ); - printf( "%10s - %s\n", - "", _( "execute named vips operation" ) ); - + print_help( argc, argv ); error_exit( _( "unknown action \"%s\"" ), action ); } From 274da3dcb6ec6dcd2a37bc1553862dbe340bc449 Mon Sep 17 00:00:00 2001 From: Sebastian Gassner Date: Tue, 13 Nov 2012 15:11:34 +0100 Subject: [PATCH 2/6] tools/batch_* scripts: verify number of arguments before invoking 'shift'. --- tools/batch_crop.in | 13 +++++++------ tools/batch_image_convert.in | 7 ++++--- tools/batch_rubber_sheet.in | 7 ++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/batch_crop.in b/tools/batch_crop.in index 982b9e66..414b18b4 100644 --- a/tools/batch_crop.in +++ b/tools/batch_crop.in @@ -12,14 +12,9 @@ VIPSHOME=${VIPSHOME-@prefix@} name=`basename $0` -left=$1 -top=$2 -width=$3 -height=$4 -shift 4 # check args -if [ $# -lt 1 ]; then +if [ $# -lt 5 ]; then echo "usage: $name left top width height image1 image2 ..." echo echo "$name writes a new set of images called crop_image1, " @@ -28,6 +23,12 @@ if [ $# -lt 1 ]; then exit 1 fi +left=$1 +top=$2 +width=$3 +height=$4 +shift 4 + # convert each argument for i in $*; do dir=`dirname $i` diff --git a/tools/batch_image_convert.in b/tools/batch_image_convert.in index e4fff85a..b72865b1 100644 --- a/tools/batch_image_convert.in +++ b/tools/batch_image_convert.in @@ -12,11 +12,9 @@ VIPSHOME=${VIPSHOME-@prefix@} name=`basename $0` -type=$1 -shift # check args -if [ $# -lt 1 ]; then +if [ $# -lt 2 ]; then echo "usage: $name image1 image2 ..." echo echo "$name uses VIPS to convert a group of image files of" @@ -27,6 +25,9 @@ if [ $# -lt 1 ]; then exit 1 fi +type=$1 +shift + # convert each argument for i in $*; do # drop the suffix on the filename diff --git a/tools/batch_rubber_sheet.in b/tools/batch_rubber_sheet.in index d36891f9..d12f1286 100644 --- a/tools/batch_rubber_sheet.in +++ b/tools/batch_rubber_sheet.in @@ -14,11 +14,9 @@ VIPSHOME=${VIPSHOME-@prefix@} # get name we were run as name=`basename $0` -rec=$1 -shift # check args -if [ $# -lt 1 ]; then +if [ $# -lt 2 ]; then echo "usage: $name matrix image1 image2 ..." echo "writes rsc_image1, rsc_image2, ..." echo @@ -28,6 +26,9 @@ if [ $# -lt 1 ]; then exit 1 fi +rec=$1 +shift + # transform each argument for i in $*; do echo "Transforming $i to rsc_$i ..." From a29d1ee7f25aa9ccd68dfe7338fac13e563e454e Mon Sep 17 00:00:00 2001 From: Sebastian Gassner Date: Tue, 13 Nov 2012 16:39:11 +0100 Subject: [PATCH 3/6] README: adding some additional dependencies needed to bootstrap/make on Debian wheezy/sid. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e974b468..6bd0cf19 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Then for a debug build: # Dependencies libvips has to have gettext, glib-2.x and libxml-2.0. The build system needs -sh, pkg-config and gnu make. +sh, pkg-config, swig, gtk-doc-tools, automake, gobject-introspection and gnu make. # Optional dependencies From 767bfc3b7f51a6a1a8e30b5d871f9bf6e2f44f8e Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Nov 2012 20:09:30 +0000 Subject: [PATCH 4/6] allow absolute file names in vipsthumbnail -o thanks fuho --- ChangeLog | 1 + tools/vipsthumbnail.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c07f4b6..7df724de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ - update for new glib threading API - remove no threads option, glib no longer support it - better --help output for vips driver prog +- vipsthumbnail -o allows absolute file names 2/10/12 started 7.30.4 - remove options from format string in .dzi (thanks Martin) diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index 17e0cc0b..a04d333c 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -31,6 +31,8 @@ * - remove "--nodelete" option, have a --delete option instead, off by * default * - much more gentle extra sharpening + * 13/11/12 + * - allow absolute paths in -o (thanks fuho) */ #ifdef HAVE_CONFIG_H @@ -306,25 +308,35 @@ thumbnail3( IMAGE *in, IMAGE *out ) static char * make_thumbnail_name( const char *filename ) { - char *dir; char *file; char *p; char buf[FILENAME_MAX]; char *result; - dir = g_path_get_dirname( filename ); file = g_path_get_basename( filename ); + /* Remove the suffix from the file portion. + */ if( (p = strrchr( file, '.' )) ) *p = '\0'; + /* output_format can be an absolute path, in which case we discard the + * path from the incoming file. + */ im_snprintf( buf, FILENAME_MAX, output_format, file ); - result = g_build_filename( dir, buf, NULL ); + if( g_path_is_absolute( output_format ) ) + result = g_strdup( buf ); + else { + char *dir; + + dir = g_path_get_dirname( filename ); + result = g_build_filename( dir, buf, NULL ); + g_free( dir ); + } if( verbose ) - printf( "thumbnailing %s as %s\n", filename, buf ); + printf( "thumbnailing %s as %s\n", filename, result ); - g_free( dir ); g_free( file ); return( result ); From 4ab937a8b61933a022ad7447bd396af69e44a7e5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 14 Nov 2012 09:59:30 +0000 Subject: [PATCH 5/6] fix library versioning mixup thanks benjamin --- ChangeLog | 3 +++ configure.in | 6 +++--- po/vips7.pot | 58 ++++++++++++++++++++++++++-------------------------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58d9dde6..80b799ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +14/11/12 started 7.30.5 +- fix libtool version mess up (thanks Benjamin) + 2/10/12 started 7.30.4 - remove options from format string in .dzi (thanks Martin) - vipsCC.pc required the wrong version of vips (thanks Alessandro) diff --git a/configure.in b/configure.in index fa77a47d..0400da8a 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [7.30.4], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [7.30.5], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [30]) -m4_define([vips_micro_version], [4]) +m4_define([vips_micro_version], [5]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` LIBRARY_CURRENT=33 LIBRARY_REVISION=7 -LIBRARY_AGE=3 +LIBRARY_AGE=2 # patched into include/vips/version.h AC_SUBST(VIPS_VERSION) diff --git a/po/vips7.pot b/po/vips7.pot index cc2b304b..a32fcf5c 100644 --- a/po/vips7.pot +++ b/po/vips7.pot @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" "product=glib&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2012-10-01 14:17+0100\n" +"POT-Creation-Date: 2012-11-14 09:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -395,7 +395,7 @@ msgstr "" #: ../libvips/conversion/extract.c:197 ../libvips/conversion/extract.c:356 #: ../libvips/conversion/bandjoin.c:171 ../libvips/conversion/copy.c:321 #: ../libvips/conversion/rot.c:359 ../libvips/conversion/replicate.c:196 -#: ../libvips/conversion/tilecache.c:357 ../libvips/conversion/embed.c:523 +#: ../libvips/conversion/tilecache.c:359 ../libvips/conversion/embed.c:523 #: ../libvips/conversion/cache.c:100 ../libvips/conversion/recomb.c:203 #: ../libvips/conversion/sequential.c:273 ../libvips/foreign/foreign.c:1413 #: ../libvips/resample/resample.c:89 @@ -567,7 +567,7 @@ msgstr "" #: ../libvips/conversion/cast.c:480 ../libvips/conversion/flatten.c:376 #: ../libvips/conversion/extract.c:198 ../libvips/conversion/extract.c:357 #: ../libvips/conversion/copy.c:322 ../libvips/conversion/rot.c:360 -#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:358 +#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:360 #: ../libvips/conversion/embed.c:524 ../libvips/conversion/cache.c:101 #: ../libvips/conversion/sequential.c:274 msgid "Input image" @@ -1104,53 +1104,53 @@ msgstr "" msgid "Top edge of sub in main" msgstr "" -#: ../libvips/conversion/tilecache.c:353 ../libvips/conversion/cache.c:96 +#: ../libvips/conversion/tilecache.c:355 ../libvips/conversion/cache.c:96 msgid "cache an image" msgstr "" -#: ../libvips/conversion/tilecache.c:363 ../libvips/conversion/cache.c:113 +#: ../libvips/conversion/tilecache.c:365 ../libvips/conversion/cache.c:113 #: ../libvips/conversion/sequential.c:286 ../libvips/foreign/tiffsave.c:222 -#: ../libvips/foreign/dzsave.c:920 +#: ../libvips/foreign/dzsave.c:927 msgid "Tile height" msgstr "" -#: ../libvips/conversion/tilecache.c:364 ../libvips/conversion/cache.c:114 +#: ../libvips/conversion/tilecache.c:366 ../libvips/conversion/cache.c:114 #: ../libvips/conversion/sequential.c:287 ../libvips/foreign/tiffsave.c:223 -#: ../libvips/foreign/dzsave.c:921 +#: ../libvips/foreign/dzsave.c:928 msgid "Tile height in pixels" msgstr "" -#: ../libvips/conversion/tilecache.c:370 +#: ../libvips/conversion/tilecache.c:372 msgid "Strategy" msgstr "" -#: ../libvips/conversion/tilecache.c:371 +#: ../libvips/conversion/tilecache.c:373 msgid "Expected access pattern" msgstr "" -#: ../libvips/conversion/tilecache.c:540 +#: ../libvips/conversion/tilecache.c:542 msgid "cache an image as a set of tiles" msgstr "" -#: ../libvips/conversion/tilecache.c:544 ../libvips/conversion/cache.c:106 -#: ../libvips/foreign/tiffsave.c:215 ../libvips/foreign/dzsave.c:913 +#: ../libvips/conversion/tilecache.c:546 ../libvips/conversion/cache.c:106 +#: ../libvips/foreign/tiffsave.c:215 ../libvips/foreign/dzsave.c:920 msgid "Tile width" msgstr "" -#: ../libvips/conversion/tilecache.c:545 ../libvips/conversion/cache.c:107 -#: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:914 +#: ../libvips/conversion/tilecache.c:547 ../libvips/conversion/cache.c:107 +#: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:921 msgid "Tile width in pixels" msgstr "" -#: ../libvips/conversion/tilecache.c:551 ../libvips/conversion/cache.c:120 +#: ../libvips/conversion/tilecache.c:553 ../libvips/conversion/cache.c:120 msgid "Max tiles" msgstr "" -#: ../libvips/conversion/tilecache.c:552 ../libvips/conversion/cache.c:121 +#: ../libvips/conversion/tilecache.c:554 ../libvips/conversion/cache.c:121 msgid "Maximum number of tiles to cache" msgstr "" -#: ../libvips/conversion/tilecache.c:706 +#: ../libvips/conversion/tilecache.c:709 msgid "cache an image as a set of lines" msgstr "" @@ -1527,48 +1527,48 @@ msgstr "" msgid "Write a bigtiff image" msgstr "" -#: ../libvips/foreign/dzsave.c:243 +#: ../libvips/foreign/dzsave.c:245 #, c-format msgid "Directory \"%s_files\" exists" msgstr "" -#: ../libvips/foreign/dzsave.c:812 +#: ../libvips/foreign/dzsave.c:819 msgid "overlap must be less than tile width and height" msgstr "" -#: ../libvips/foreign/dzsave.c:865 +#: ../libvips/foreign/dzsave.c:872 msgid "save image to deep zoom format" msgstr "" -#: ../libvips/foreign/dzsave.c:875 ../libvips/foreign/dzsave.c:906 +#: ../libvips/foreign/dzsave.c:882 ../libvips/foreign/dzsave.c:913 msgid "Base name" msgstr "" -#: ../libvips/foreign/dzsave.c:876 ../libvips/foreign/dzsave.c:907 +#: ../libvips/foreign/dzsave.c:883 ../libvips/foreign/dzsave.c:914 msgid "Base name to save to" msgstr "" -#: ../libvips/foreign/dzsave.c:882 +#: ../libvips/foreign/dzsave.c:889 msgid "suffix" msgstr "" -#: ../libvips/foreign/dzsave.c:883 +#: ../libvips/foreign/dzsave.c:890 msgid "Filename suffix for tiles" msgstr "" -#: ../libvips/foreign/dzsave.c:889 +#: ../libvips/foreign/dzsave.c:896 msgid "Overlap" msgstr "" -#: ../libvips/foreign/dzsave.c:890 +#: ../libvips/foreign/dzsave.c:897 msgid "Tile overlap in pixels" msgstr "" -#: ../libvips/foreign/dzsave.c:896 +#: ../libvips/foreign/dzsave.c:903 msgid "Tile size" msgstr "" -#: ../libvips/foreign/dzsave.c:897 +#: ../libvips/foreign/dzsave.c:904 msgid "Tile size in pixels" msgstr "" From efcc53859a1d1693461391d7f304899d9549a483 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 14 Nov 2012 14:44:21 +0000 Subject: [PATCH 6/6] capture tiff warnings during startup We were not capturing warnings from libtiff until we used libtiff ourselves. Other libraries whcih we call, such as ImageMagick, could use libtiff and generate an uncaptured warning. On Windows these warnings each produced a popup. --- ChangeLog | 3 +++ configure.in | 6 +++--- libvips/foreign/tiff.h | 3 +-- libvips/foreign/tiff2vips.c | 28 ++++++++++++++++------------ libvips/foreign/tiffload.c | 7 +++++++ libvips/foreign/vips2tiff.c | 6 +----- 6 files changed, 31 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80b799ec..9be0bcae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +14/11/12 started 7.30.6 +- capture tiff warnings earlier + 14/11/12 started 7.30.5 - fix libtool version mess up (thanks Benjamin) diff --git a/configure.in b/configure.in index 0400da8a..dade4754 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [7.30.5], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [7.30.6], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [30]) -m4_define([vips_micro_version], [5]) +m4_define([vips_micro_version], [6]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=33 -LIBRARY_REVISION=7 +LIBRARY_REVISION=8 LIBRARY_AGE=2 # patched into include/vips/version.h diff --git a/libvips/foreign/tiff.h b/libvips/foreign/tiff.h index d9ab22f4..009c0448 100644 --- a/libvips/foreign/tiff.h +++ b/libvips/foreign/tiff.h @@ -36,8 +36,7 @@ extern "C" { extern const char *vips__foreign_tiff_suffs[]; -void vips__thandler_error( const char *module, const char *fmt, va_list ap ); -void vips__thandler_warning( const char *module, const char *fmt, va_list ap ); +void vips__tiff_init( void ); int vips__tiff_write( VipsImage *in, const char *filename, VipsForeignTiffCompression compression, int Q, diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index ddfcf730..7cb8f3c9 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -229,13 +229,13 @@ typedef struct { * more than one thread, but vips_error and vips_warn have mutexes in, so that's * OK. */ -void +static void vips__thandler_error( const char *module, const char *fmt, va_list ap ) { vips_verror( module, fmt, ap ); } -void +static void vips__thandler_warning( const char *module, const char *fmt, va_list ap ) { char buf[256]; @@ -244,6 +244,16 @@ vips__thandler_warning( const char *module, const char *fmt, va_list ap ) vips_warn( module, "%s", buf ); } +/* Call this during startup. Other libraries may be using libtiff and we want + * to capture any messages they send as well. + */ +void +vips__tiff_init( void ) +{ + TIFFSetErrorHandler( vips__thandler_error ); + TIFFSetWarningHandler( vips__thandler_warning ); +} + /* Test for field exists. */ static int @@ -1506,8 +1516,7 @@ istiffpyramid( const char *name ) { TIFF *tif; - TIFFSetErrorHandler( vips__thandler_error ); - TIFFSetWarningHandler( vips__thandler_warning ); + vips__tiff_init(); if( (tif = get_directory( name, 2 )) ) { // We can see page 2 ... assume it is. @@ -1529,8 +1538,7 @@ vips__tiff_read( const char *filename, VipsImage *out, int page ) printf( "tiff2vips: libtiff starting for %s\n", filename ); #endif /*DEBUG*/ - TIFFSetErrorHandler( vips__thandler_error ); - TIFFSetWarningHandler( vips__thandler_warning ); + vips__tiff_init(); if( !(rtiff = readtiff_new( filename, out, page )) ) return( -1 ); @@ -1558,8 +1566,7 @@ vips__tiff_read_header( const char *filename, VipsImage *out, int page ) { ReadTiff *rtiff; - TIFFSetErrorHandler( vips__thandler_error ); - TIFFSetWarningHandler( vips__thandler_warning ); + vips__tiff_init(); if( !(rtiff = readtiff_new( filename, out, page )) ) return( -1 ); @@ -1583,10 +1590,7 @@ vips__istifftiled( const char *filename ) TIFF *tif; gboolean tiled; - /* Override the default TIFF error handler. - */ - TIFFSetErrorHandler( vips__thandler_error ); - TIFFSetWarningHandler( vips__thandler_warning ); + vips__tiff_init(); if( !(tif = TIFFOpen( filename, "rm" )) ) { vips_error_clear(); diff --git a/libvips/foreign/tiffload.c b/libvips/foreign/tiffload.c index 1c229646..267458c9 100644 --- a/libvips/foreign/tiffload.c +++ b/libvips/foreign/tiffload.c @@ -123,6 +123,13 @@ vips_foreign_load_tiff_class_init( VipsForeignLoadTiffClass *class ) VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; + /* Other libraries may be using libtiff, we want to capture tiff + * warning and error as soon as we can. + * + * This class init will be triggered during startup. + */ + vips__tiff_init(); + gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index b673aacb..66da6955 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1474,7 +1474,6 @@ gather_pyramid( TiffWrite *tw ) return( 0 ); } - int vips__tiff_write( VipsImage *in, const char *filename, VipsForeignTiffCompression compression, int Q, @@ -1493,10 +1492,7 @@ vips__tiff_write( VipsImage *in, const char *filename, printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() ); #endif /*DEBUG*/ - /* Override the default TIFF error handler. - */ - TIFFSetErrorHandler( vips__thandler_error ); - TIFFSetWarningHandler( vips__thandler_warning ); + vips__tiff_init(); /* Check input image. */