Skip to content

Commit 7c6116b

Browse files
committed
Merge pull request #76 from larsan/master
Changed tostring() to tobytes() because the former is deprecated
2 parents 511f488 + be95a71 commit 7c6116b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ocrolib/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ def write_text(fname,text,nonl=0,normalize=1):
177177

178178
def pil2array(im,alpha=0):
179179
if im.mode=="L":
180-
a = numpy.fromstring(im.tostring(),'B')
180+
a = numpy.fromstring(im.tobytes(),'B')
181181
a.shape = im.size[1],im.size[0]
182182
return a
183183
if im.mode=="RGB":
184-
a = numpy.fromstring(im.tostring(),'B')
184+
a = numpy.fromstring(im.tobytes(),'B')
185185
a.shape = im.size[1],im.size[0],3
186186
return a
187187
if im.mode=="RGBA":
188-
a = numpy.fromstring(im.tostring(),'B')
188+
a = numpy.fromstring(im.tobytes(),'B')
189189
a.shape = im.size[1],im.size[0],4
190190
if not alpha: a = a[:,:,:3]
191191
return a

0 commit comments

Comments
 (0)