The Wayback Machine - https://web.archive.org/web/20240118181250/https://www.geeksforgeeks.org/python-read-blob-object-in-python-using-wand-library/
Open In App
Related Articles

Python – Read blob object in python using wand library

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

BLOB stands for Binary Large OBject. A blob is a data type that can store binary data. This is different than most other data types used in databases, such as integers, floating point numbers, characters, and strings, which store letters and numbers. BLOB is a large complex collection of binary data which is stored in Database. Basically BLOB is used to store media files like images, video and audio files. Due to its ability to store multimedia files it takes a huge disk space. Also length of BLOB may go upto 2, 147, 483, 647 characters. BLOB provides fast multimedia transfer. 
To get blob file from image : 
 

     with open('image_path') as f:
    image_blob = f.read()

To read image from blob in Wand : 
 

with Image(blob=image_binary) as img:
    \\other code

Input Image : 
 

Code : 
 

Python3




# import required libraries
from __future__ import print_function
 
# import Image from wand.image module
from wand.image import Image
 
# open image using file handling
with open('koala.jpeg') as f:
 
    # get blob from image file
    image_blob = f.read()
 
# read image using wand from blob file
with Image(blob = image_binary) as img:
 
    # get height of image
    print('height =', img.height)
 
    # get width of image
    print('width =', img.width)


Output : 
 

height = 300
width = 400

 

Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills, become a part of the hottest trend in the 21st century.
Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve.

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 07 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials