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
This commit is contained in:
John Cupitt 2014-07-13 10:43:50 +01:00
parent a9fdde9ddb
commit 89f8c58057
2 changed files with 24 additions and 0 deletions

23
TODO
View File

@ -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?

View File

@ -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 );