Skip to content Skip to sidebar Skip to footer

How To Convert Save_base64 To Image In Python

I use code as below to download Image with query string, it is no any problems. urlServer = 'http://ipcamera-viewer.com/image/?p=199619_20170221_162149_7208.jpg' browser.get(urlSer

Solution 1:

Something like this should do the trick, rather then saving just to read it in again. Didn't get the chance to try this out though.

from PIL import Image
from io import BytesIO
import base64


im = Image.open(BytesIO(base64.b64decode(imgData)))
im = im.rotate(45)
im.save(pathLocal)

Solution 2:

With the PIL Image module you can do like this

from PIL import Image
im = Image.open("bride.jpg")
im = im.rotate(45)

Post a Comment for "How To Convert Save_base64 To Image In Python"