File tree 1 file changed +18
-16
lines changed
1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -801,22 +801,6 @@ def to_imagemagick(img, bits=16):
801
801
802
802
if not isinstance (img , PMImage ):
803
803
804
- def _scale (img , bits = 16 ):
805
- '''Scale image to cover the whole bit-range.
806
- '''
807
-
808
- LOGGER .debug ("Scaling image to %d bits." , bits )
809
-
810
- img -= img .min ()
811
- img_max = np .max (img )
812
- if img_max != 0 :
813
- img = (2 ** bits - 1 ) * img / img_max
814
-
815
- if bits <= 8 :
816
- return img .astype ('uint8' )
817
- else :
818
- return img .astype ('uint16' )
819
-
820
804
img = _scale (img , bits = bits )
821
805
822
806
LOGGER .debug ("Converting from Numpy to ImageMagick." )
@@ -845,6 +829,24 @@ def _scale(img, bits=16):
845
829
return out_img
846
830
return img
847
831
832
+
833
+ def _scale (img , bits = 16 ):
834
+ '''Scale image to cover the whole bit-range.
835
+ '''
836
+
837
+ LOGGER .debug ("Scaling image to %d bits." , bits )
838
+
839
+ img -= img .min ()
840
+ img_max = np .max (img )
841
+ if img_max != 0 :
842
+ img = (2 ** bits - 1 ) * img / img_max
843
+
844
+ if bits <= 8 :
845
+ return img .astype ('uint8' )
846
+ else :
847
+ return img .astype ('uint16' )
848
+
849
+
848
850
def polyfit2d (x_loc , y_loc , z_val , order = 2 ):
849
851
'''Fit a 2-D polynomial to the given data.
850
852
You can’t perform that action at this time.
0 commit comments