From 89f8c58057336d29f599e0aebc80d179f342b0ac Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 13 Jul 2014 10:43:50 +0100 Subject: [PATCH] tiny vips_scale() fix vips_scale() on a black image now returns an image with the right number of bands ... was always a 1 band image before --- TODO | 23 +++++++++++++++++++++++ libvips/conversion/scale.c | 1 + 2 files changed, 24 insertions(+) diff --git a/TODO b/TODO index 0475cf41..deae2057 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,27 @@ +- maxpos_avg seems to give variable results + + irb(main):022:0> im.maxpos_avg + => [141.0, 138.0, 248.0] + irb(main):023:0> im.maxpos_avg + => [73.0, 95.0, 248.0] + + [107.0, 116.5, 248.0] is correct, checked by hand + +$ vips max --size 10 spec/samples/wagon.v --x-array --y-array --out-array +72 107 78 73 74 75 99 100 141 73 +95 141 94 94 94 95 131 131 138 95 +245 246 246 247 247 247 247 247 248 248 +248.000000 + + so there are two maxes of 248, result should be average of the two + + seems to be a race in maxpos_avg, it's still some Tom code, replace with a + wrapper over vips_max() + + + + - threadpool recyling might be useful for dzsave? diff --git a/libvips/conversion/scale.c b/libvips/conversion/scale.c index 181e9aa1..e08197bb 100644 --- a/libvips/conversion/scale.c +++ b/libvips/conversion/scale.c @@ -98,6 +98,7 @@ vips_scale_build( VipsObject *object ) /* Range of zero: just return black. */ if( vips_black( &t[1], scale->in->Xsize, scale->in->Ysize, + "bands", scale->in->Bands, NULL ) || vips_image_write( t[1], conversion->out ) ) return( -1 );