from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from PIL import Image
import io
msg = MIMEMultipart()
im = Image.new('RGB', (200, 200))
memf = io.StringIO()
im.save(memf, 'JPEG')
img = MIMEImage(memf.getvalue())
msg.attach(img)
Converting PIL image to MIMEImage