Python Forum

Full Version: Binary data to Image convert
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In my case I stored binary data inside user collection as user_pic using mongoengine. It looks like this
"user_pic": {
        "$binary": {
            "base64": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDABQODxI........
...........AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/2Q==",
            "subType": "00"
        }
    }
[When I convert this binary code to image using some online converters, It gives expected image]. So now I want to convert this binary code to image and show that images to users through user interface. Is there any way to do this?
This is Base64 encoding, often used in email and Usenet from the old days.

https://www.base64decoder.io/python/

Should be of help here...