Skip to content

Commit

Permalink
changed tostring() to tobytes() because the former is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
larsan committed Jan 7, 2016
1 parent 511f488 commit be95a71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ocrolib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ def write_text(fname,text,nonl=0,normalize=1):

def pil2array(im,alpha=0):
if im.mode=="L":
a = numpy.fromstring(im.tostring(),'B')
a = numpy.fromstring(im.tobytes(),'B')
a.shape = im.size[1],im.size[0]
return a
if im.mode=="RGB":
a = numpy.fromstring(im.tostring(),'B')
a = numpy.fromstring(im.tobytes(),'B')
a.shape = im.size[1],im.size[0],3
return a
if im.mode=="RGBA":
a = numpy.fromstring(im.tostring(),'B')
a = numpy.fromstring(im.tobytes(),'B')
a.shape = im.size[1],im.size[0],4
if not alpha: a = a[:,:,:3]
return a
Expand Down

0 comments on commit be95a71

Please sign in to comment.