im save to a bytes io python

Solutions on MaxInterview for im save to a bytes io python by the best coders in the world

showing results for - "im save to a bytes io python"
Mira
06 Jan 2018
1from io import BytesIO
2from PIL import Image, ImageDraw
3
4image = Image.new("RGB", (300, 50))
5draw = ImageDraw.Draw(image)
6draw.text((0, 0), "This text is drawn on image")
7
8byte_io = BytesIO()
9
10image.save(byte_io, 'PNG')