how to read binary after resize image on python?
<p>i use two packages
<code>from PIL import Image</code> and <code>from resizeimage import resizeimage</code> when i use this packages i should after resize save to other image file, but i need image binary after resize not save to other file ?</p>

<p>code :</p>

<pre><code>with open(imgpath, 'r+b') as f:
    with Image.open(f) as image:
        cover = resizeimage.resize_cover(image, [100, 100])
             img =  bytearray(cover.read())
</code></pre>

<p>i need read binary like this : <code>bytearray(cover.read())</code> this code not work,
how to read binary after resize image?</p>

<p>please use this code.</p>

<pre><code>basewidth = 100
hsize =  100
img = Image.open(imgpath)
img = img.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
byte_io = io.BytesIO()
img.save(byte_io, format='PNG')
byte_io = byte_io.getvalue()
print byte_io
</code></pre>

python python-2.7 opencv