@@ -338,7 +338,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
338
338
339
339
if not unsampled :
340
340
if A .ndim not in (2 , 3 ):
341
- raise ValueError ("Invalid dimensions, got {}" .format (A .shape ))
341
+ raise ValueError ("Invalid shape {} for image data"
342
+ .format (A .shape ))
342
343
343
344
if A .ndim == 2 :
344
345
# if we are a 2D array, then we are running through the
@@ -482,7 +483,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
482
483
if A .shape [2 ] == 3 :
483
484
A = _rgb_to_rgba (A )
484
485
elif A .shape [2 ] != 4 :
485
- raise ValueError ("Invalid dimensions, got %s" % (A .shape ,))
486
+ raise ValueError ("Invalid shape {} for image data"
487
+ .format (A .shape ))
486
488
487
489
output = np .zeros ((out_height , out_width , 4 ), dtype = A .dtype )
488
490
@@ -638,11 +640,13 @@ def set_data(self, A):
638
640
639
641
if (self ._A .dtype != np .uint8 and
640
642
not np .can_cast (self ._A .dtype , float , "same_kind" )):
641
- raise TypeError ("Image data cannot be converted to float" )
643
+ raise TypeError ("Image data of dtype {} cannot be converted to "
644
+ "float" .format (self ._A .dtype ))
642
645
643
646
if not (self ._A .ndim == 2
644
647
or self ._A .ndim == 3 and self ._A .shape [- 1 ] in [3 , 4 ]):
645
- raise TypeError ("Invalid dimensions for image data" )
648
+ raise TypeError ("Invalid shape {} for image data"
649
+ .format (self ._A .shape ))
646
650
647
651
if self ._A .ndim == 3 :
648
652
# If the input data has values outside the valid range (after
0 commit comments