@@ -486,16 +486,29 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
486
486
raise ValueError ("Invalid dimensions, got %s" % (A .shape ,))
487
487
488
488
output = np .zeros ((out_height , out_width , 4 ), dtype = A .dtype )
489
+ output_a = np .zeros ((out_height , out_width ), dtype = A .dtype )
489
490
490
491
alpha = self .get_alpha ()
491
492
if alpha is None :
492
- alpha = 1.0
493
+ alpha = 1
494
+
495
+ #resample alpha channel
496
+ alpha_channel = A [...,3 ]
497
+ _image .resample (
498
+ alpha_channel , output_a , t , _interpd_ [self .get_interpolation ()],
499
+ self .get_resample (), alpha ,
500
+ self .get_filternorm (), self .get_filterrad ())
493
501
502
+ #resample rgb channels
503
+ A = _rgb_to_rgba (A [...,:3 ])
494
504
_image .resample (
495
505
A , output , t , _interpd_ [self .get_interpolation ()],
496
506
self .get_resample (), alpha ,
497
507
self .get_filternorm (), self .get_filterrad ())
498
508
509
+ #recombine rgb and alpha channels
510
+ output [...,3 ] = output_a
511
+
499
512
# at this point output is either a 2D array of normed data
500
513
# (of int or float)
501
514
# or an RGBA array of re-sampled input
0 commit comments