pil.jpegimageplugin.jpegimagefile to numpy array code example
Example 1: pil image to numpy
>>> pix = numpy.array(pic)
Example 2: pil.jpegimageplugin.jpegimagefile to image
import io
from PIL import Image
# Encode your PIL Image as a JPEG without writing to disk
buffer = io.BytesIO()
YourImage.save(buffer, format='JPEG', quality=75)
# You probably want
desiredObject = buffer.getbuffer()