Python Forum
Binary data to Image convert
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Binary data to Image convert
#1
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?
Reply
#2
This is Base64 encoding, often used in email and Usenet from the old days.

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

Should be of help here...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 5,857 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  Convert File to Data URL michaelnicol 3 1,143 Jul-08-2023, 11:35 AM
Last Post: DeaD_EyE
  openpyxl convert data to float jacklee26 13 5,912 Nov-19-2022, 11:59 AM
Last Post: deanhystad
  Unable to request image from FORM Data usman 0 985 Aug-18-2022, 06:23 PM
Last Post: usman
  Convert nested sample json api data into csv in python shantanu97 3 2,795 May-21-2022, 01:30 PM
Last Post: deanhystad
  convert pcm to image satyanarayana 1 1,548 Dec-06-2021, 02:54 PM
Last Post: DeaD_EyE
  Converting an RGBA image to Grayscale and Binary Joni_Engr 3 4,616 Aug-23-2021, 11:54 AM
Last Post: Pedroski55
  How to convert binary data into text? ZYSIA 3 2,621 Jul-16-2021, 04:18 PM
Last Post: deanhystad
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 7,682 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  Convert file of hex strings to binary file medatib531 4 13,705 Oct-09-2020, 05:42 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020