python - Converting jpeg string to PIL image object -
i've been handed list of files backend of application supposed jpeg files. life of me haven't been able convert them pil image objects. when call
str(curimg)
i back:
<type 'str'>
. have tried using open(), .read, io.bytesio(img.read() , doing nothing it, keeps seeing string. when print string, unrecognizable characters. know how tell python how intepret string jpeg , convert pill image can call .size , np.array on?
you should able pass stringio object pil , open way.
ie:
from pil import image import stringio tempbuff = stringio.stringio() tempbuff.write(curimg) tempbuff.seek(0) #need jump beginning before handing off pil image.open(tempbuff)
Comments
Post a Comment