diff --git a/.travis.yml b/.travis.yml index aebe3d18..7e99cecd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,17 +9,13 @@ before_script: script: - make -Ctest -j$JOBS -s V=0 VERBOSE=1 check -# allow osx to fail since brew so often falls over matrix: fast_finish: true - allow_failures: - - os: osx include: - os: linux sudo: required dist: precise env: - - PYTHON=/usr/bin/python - JPEG=/usr - JOBS=`nproc` - LIBTOOLFLAGS=--quiet @@ -36,13 +32,11 @@ matrix: liborc-0.4-dev liblcms2-dev libpoppler-glib-dev librsvg2-dev libgif-dev libpango1.0-dev - python-dev - os: linux sudo: required dist: trusty env: - - PYTHON=/usr/bin/python - JPEG=/usr - JOBS=`nproc` cache: ccache @@ -58,12 +52,10 @@ matrix: liborc-0.4-dev liblcms2-dev libpoppler-glib-dev librsvg2-dev libgif-dev libpango1.0-dev libgsf-1-dev libopenslide-dev - python-dev python-gi-dev libgirepository1.0-dev - os: osx osx_image: xcode7.3 env: - - PYTHON=/usr/local/bin/python - JPEG=/usr/local/opt/mozjpeg - JOBS="`sysctl -n hw.ncpu`" - PATH="/usr/local/opt/ccache/libexec:$PATH" @@ -71,7 +63,7 @@ matrix: before_install: - brew tap homebrew/science - brew update - - brew install ccache pkg-config automake + - brew install ccache - brew install --ignore-dependencies gtk-doc - brew install gobject-introspection @@ -81,5 +73,5 @@ matrix: cfitsio libmatio orc little-cms2 poppler pango libgsf openslide - librsvg giflib openexr - - brew install pygobject3 + librsvg openexr + diff --git a/libvips/arithmetic/avg.c b/libvips/arithmetic/avg.c index 8946f72e..a7d18fc5 100644 --- a/libvips/arithmetic/avg.c +++ b/libvips/arithmetic/avg.c @@ -225,9 +225,9 @@ vips_avg_init( VipsAvg *avg ) /** - * vips_avg: + * vips_avg: (method) * @in: input #VipsImage - * @out: output pixel average + * @out: (out): output pixel average * @...: %NULL-terminated list of optional named arguments * * This operation finds the average value in an image. It operates on all diff --git a/libvips/arithmetic/find_trim.c b/libvips/arithmetic/find_trim.c index 66a030be..1eada0b0 100644 --- a/libvips/arithmetic/find_trim.c +++ b/libvips/arithmetic/find_trim.c @@ -2,6 +2,9 @@ * * 26/7/17 * - from a ruby example + * 18/9/17 kleisauke + * - missing bandor + * - only flatten if there is an alpha */ /* @@ -69,6 +72,7 @@ vips_find_trim_build( VipsObject *object ) VipsFindTrim *find_trim = (VipsFindTrim *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 20 ); + VipsImage *in; double *background; int n; double *neg_bg; @@ -93,12 +97,16 @@ vips_find_trim_build( VipsObject *object ) vips_array_double_newv( 1, 65535.0 ); } - /* Flatten out any alpha. + /* Flatten out alpha, if any. */ - if( vips_flatten( find_trim->in, &t[0], - "background", find_trim->background, - NULL ) ) - return( -1 ); + in = find_trim->in; + if( vips_image_hasalpha( in ) ) { + if( vips_flatten( in, &t[0], + "background", find_trim->background, + NULL ) ) + return( -1 ); + in = t[0]; + } /* We want to subtract the bg. */ @@ -113,42 +121,44 @@ vips_find_trim_build( VipsObject *object ) /* Smooth, find difference from bg, abs, threshold. */ - if( vips_median( t[0], &t[1], 3, NULL ) || + if( vips_median( in, &t[1], 3, NULL ) || vips_linear( t[1], &t[2], ones, neg_bg, n, NULL ) || vips_abs( t[2], &t[3], NULL ) || - vips_more_const1( t[3], &t[4], find_trim->threshold, NULL ) ) + vips_more_const1( t[3], &t[4], find_trim->threshold, NULL ) || + vips_bandor( t[4], &t[5], NULL ) ) return( -1 ); + in = t[5]; - /* t[5] == column sums, t[6] == row sums. + /* t[6] == column sums, t[7] == row sums. */ - if( vips_project( t[4], &t[5], &t[6], NULL ) ) + if( vips_project( in, &t[6], &t[7], NULL ) ) return( -1 ); /* t[8] == search column sums in from left. */ - if( vips_profile( t[5], &t[7], &t[8], NULL ) || - vips_avg( t[8], &left, NULL ) ) + if( vips_profile( t[6], &t[8], &t[9], NULL ) || + vips_avg( t[9], &left, NULL ) ) return( -1 ); - if( vips_flip( t[5], &t[9], VIPS_DIRECTION_HORIZONTAL, NULL ) || - vips_profile( t[9], &t[10], &t[11], NULL ) || - vips_avg( t[11], &right, NULL ) ) + if( vips_flip( t[6], &t[10], VIPS_DIRECTION_HORIZONTAL, NULL ) || + vips_profile( t[10], &t[11], &t[12], NULL ) || + vips_avg( t[12], &right, NULL ) ) return( -1 ); /* t[8] == search column sums in from left. */ - if( vips_profile( t[6], &t[12], &t[13], NULL ) || - vips_avg( t[12], &top, NULL ) ) + if( vips_profile( t[7], &t[13], &t[14], NULL ) || + vips_avg( t[13], &top, NULL ) ) return( -1 ); - if( vips_flip( t[6], &t[14], VIPS_DIRECTION_VERTICAL, NULL ) || - vips_profile( t[14], &t[15], &t[16], NULL ) || - vips_avg( t[15], &bottom, NULL ) ) + if( vips_flip( t[7], &t[15], VIPS_DIRECTION_VERTICAL, NULL ) || + vips_profile( t[15], &t[16], &t[17], NULL ) || + vips_avg( t[16], &bottom, NULL ) ) return( -1 ); g_object_set( find_trim, "left", (int) left, "top", (int) top, - "width", (int) VIPS_MAX( 0, (t[5]->Xsize - right) - left ), - "height", (int) VIPS_MAX( 0, (t[6]->Ysize - bottom) - top ), + "width", (int) VIPS_MAX( 0, (t[6]->Xsize - right) - left ), + "height", (int) VIPS_MAX( 0, (t[7]->Ysize - bottom) - top ), NULL ); return( 0 ); @@ -253,7 +263,8 @@ vips_find_trim_init( VipsFindTrim *find_trim ) * and @height == 0. * * @background defaults to 255, or 65535 for 16-bit images. Set another value, - * or use vips_getpoint() to pick a value from an edge. + * or use vips_getpoint() to pick a value from an edge. You'll need to flatten + * before vips_getpoint() to get a correct background value. * * @threshold defaults to 10. * diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index 9129b152..a3d70477 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -453,6 +453,8 @@ vips__cache_once_init( void ) vips_cache_table = g_hash_table_new( (GHashFunc) vips_operation_hash, (GEqualFunc) vips_operation_equal ); + + return( NULL ); } void