Insert and Display image from database using python - python

import mysql.connector
import base64
import io
from base64 import b64decode
from PIL import Image
import PIL.Image
with open('assets\zoha.jpeg', 'rb') as f:
photo = f.read()
encodestring = base64.b64encode(photo)
db=
mysql.connector.connect(user="root",password="",
host="localhost",database="pythonfacedetection")
mycursor=db.cursor()
sql = "INSERT INTO image(img) VALUES(%s)"
mycursor.execute(sql,(encodestring,))
db.commit()
sql1="select img from image where id=75"
mycursor.execute(sql1)
data = mycursor.fetchall()
image=data[0][0]
img = base64.b64decode(str(image))
img2=io.BytesIO(img )
img3= Image.open(img2)
img.show()
db.close()
I want to save my photo in database and display that photo from the database. The data has save on the database properly but can not display. I tried a lot but every time this error shows. Please advise me how can I solve this.
Traceback (most recent call last):
File "C:/Users/MDSHADMANZOHA/PycharmProjects/ImageFromDatabase/main.py", line 28, in
<module>
img3= Image.open(img2)
File "C:\Users\MDSHADMANZOHA\PycharmProjects\ImageFromDatabase\venv\lib\site-
packages\PIL\Image.py", line 3009, in open
"cannot identify image file %r" % (filename if filename else fp)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at
0x0000020247DCE308>

Related

"cannot identify image file"-error when trying to load a tiff in python

I am trying to access to the temperature data stored in a tiff-file. I was provided with a python script that was supposed to be able to do this, but I keep getting the following error:
Traceback (most recent call last):
File "read_tiff.py", line 57, in <module>
im = Image.open(sourcePath)
File "/Users/myname/opt/anaconda3/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file 'Testbild.tiff'
This is the relevant section of the code:
sourcePath = "Testbild.tiff"
im = []
try:
sourcePath = sys.argv[1]
except IndexError:
print('usage: python read_tiff.py filename')
sys.exit()
try:
im = Image.open(sourcePath)
except FileNotFoundError:
print('File not found: ' + sourcePath)
sys.exit()
imarray = np.array(im)
This is what I checked:
with another random tiff file it worked, so it is probably not the script but the file itself (/maybe I need to install some additional package??)
the tiff file can be opened without a problem in IrfanView and Photoscan
when prompting "file Testbild.tiff" I get "Testbild.tiff: TIFF image data, little-endian" so it definitely IS a tiff file
Is anyone able to help me out?
Cheers!
EDIT:
The import statement for Image is from PIL import Image
If necessary, these are all the import statements of the script:
import matplotlib.pyplot as plt
from PIL import Image
import sys
import numpy as np
import math
import cv2
Try using:
from skimage import io
im = io.imread(sourcePath)
This will open it directly as an array as well.
In my case, it worked to read .tif file to ndarray:
path2dir = r'C:\data\WORK\image4example'
name_img = 'Slice_25.tif'
path2img = os.path.join(path2dir, name_img)
im = cv2.imread(path2img , cv2.IMREAD_ANYDEPTH)
plt.imshow(im)

How to convert Base64 String to image in PYTHON

i am scraping amazon products image but in some time i get base64 string not image link , so i want to convert this string to image .
i tried this code but got error
CODE:
import base64
from PIL import Image
from io import BytesIO
f = open('C:\\Users\\pc\\Desktop\\base64.txt','r')
data = f.read()
im = Image.open(BytesIO(base64.b64decode(data)))
im.save('C:\\Users\\pc\\Desktop\\image.png', 'PNG')
ERROR:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (16369) cannot be 1 more than a multiple of 4
Base64:
data:image/webp;base64,UklGRrQ6AABXRUJQVlA4IKg6AAAw7ACdASo/ASwBPrFKmkekIiEU2r5ERAsE4vviiQDHoCPrX4ipDeU/JuPLgv9g5f/vXfT/5vrH/s/qE88r+7/9n1P/tb+w/vM/kr75v8p6gH9m6n30FumL/wPnoYPxqT4d+cn5bou5Z+13U778/6/rN/n/Cf5fakHuPwU9xhtf+t9BT2k+7+cn9950fxn+y9gPzQ/8fjAfiv+j7A/9V/x//h/yHu//6Xla+wfYU6ZnpANu0pY3+8S8ONu6NNpvsCTLf6sfvCGmXMtg7P4aXvlaOF3TNN8ZLla6Xpgb7dV+v1cbQa3mGtirv9YSCjpI4FqZ0HrmJJq0vdN8hQkImfY8uy/DuGgZjG5Yw/8RclGmJb1UFLmk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APa8b56F8Uacc/4wZ83YriLaIm4nasz+shx/m8IvER8DGFT2RDSbG33C2CFS53QbrueMbQ5xUxcC9N29SQftdzxtHF6kgnpeVlTHzLixgdefqHsjjxzhiJoSNo8o3p0cbV8lucaw3Ex8J6XH8LKkcVSgPcLeKw0m9ucADQ+1Mugtxz/UwPlbBEctAAAAAA
i know there are many of questions like this one but i didn't find good answer
This data is not exactly base64 notice the prefix data:
data:image/webp;base64,
This data must be stripped first, then it's valid base64 to be processed as an image.
import base64
from PIL import Image
from io import BytesIO
f = open('C:\\Users\\pc\\Desktop\\base64.txt','r')
data = f.read()
prefix = 'data:image/webp;base64,'
cut = data[len(prefix):]
im = Image.open(BytesIO(base64.b64decode(cut)))
im.save('C:\\Users\\pc\\Desktop\\image.png', 'PNG')

How to insert image into sqlite3 database?

Here is part of my code:
import sqlite3
import tkinter
import time
import PIL.Image, PIL.ImageTk
from PIL import Image,ImageTk
import cv2
import numpy as np
from tkinter import Tk, Label, Button, Entry, Toplevel
r=Tk()
conn = sqlite3.connect('datastorage.db')
print("Opened database successfully");
def snapshot(self):
# Get a frame from the video source
ret, frame = self.vid.get_frame()
I am capturing a frame from video and I need to insert it into a database which contains a text column and a blob(Binary Large Object) column. There are other similar questions which suggest converting to string and storing but since I already have images in blob format stored and I am extracting them using decode as seen in the code below, I need to store blob only.
blob_data=row[1]
nparr = np.frombuffer(blob_data, np.uint8)
img_np = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
image1=cv2.resize(img_np,(260,200))
#cv2.imshow("data",image1)
#break
#Rearrang the color channel
b,g,r = cv2.split(image1)
image1 = cv2.merge((r,g,b))
hsv1=cv2.cvtColor(image1, cv2.COLOR_RGB2HSV)
kernel2 = np.ones((3,3),np.uint8)
I tried using the following query:
cursor=conn.execute("create table if not exists user_6 (id text, img blob)")
cursor=conn.execute("insert into user_6 values (?,?)",(ins,sqlite3.Binary(frame)))
but I am unable to display it using the same method I used to display all the other entries. The code used to display is the 2nd code block. I am encountering an error as shown:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\ABC\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\ABC\Desktop\Python tut\gui databse.py", line 71, in display
image1=cv2.resize(img_np,(130,100))
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:4045: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
Can anyone help me out?
I was able to do it using the following code:
img_str = cv2.imencode('.jpg', frame)[1].tostring()
cursor=conn.execute("create table if not exists user_6 (id text, img blob)")
cursor=conn.execute("insert into user_6 values (?,?)",(ins,img_str))
conn.commit()
Although the colors in the image are different from the captured image.

Retrieve image from sqlite3 and display in Kivy image widget - ValueError

REQUIREMENT
I'm trying to retrieve an image from Database and set this image to kivy image widget, this operation throws a ValueError, unsure of the cause. Welcome any inputs.
Database: Sqlite3
Table name: Users
Columns: UserID, UserName, UserImage
def populate_fields(self): # NEW
# Code retrieves text data and display in textinput fields here.
# STEP 1: RETRIEVE IMAGE
connection = sqlite3.connect("demo.db")
with connection:
cursor = connection.cursor()
cursor.execute("SELECT UserImage from Users where
UserID=?",self.data_items[columns[0]]['text'] )
image = cursor.fetchone()
data = io.BytesIO(image[0])
#STEP 2: SET OUTPUT TO IMAGE WIDGET
self.image.source = data # ---> triggers an Error
ERROR TRACEBACK:
self.image.source = data
File "kivy\weakproxy.pyx", line 33, in kivy.weakproxy.WeakProxy.__setattr__ (kivy\weakproxy.c:1471)
File "kivy\properties.pyx", line 478, in kivy.properties.Property.__set__ (kivy\properties.c:5572)
File "kivy\properties.pyx", line 513, in kivy.properties.Property.set (kivy\properties.c:6352)
File "kivy\properties.pyx", line 504, in kivy.properties.Property.set (kivy\properties.c:6173)
File "kivy\properties.pyx", line 676, in kivy.properties.StringProperty.check (kivy\properties.c:8613)
ValueError: Image.source accept only str
After execution of io.BytesIO(), data is in Bytes. Use Kivy CoreImage and texture to convert data.
Replace
self.image.source = data
with:
self.image.texture = CoreImage(data, ext="png").texture
Image source
source
Filename / source of your image.
source is a StringProperty and defaults to None
Output
Ikolim's answer is good but to be more specific,
If you want to display a binary image directly into kivy you can simply work with io module (import io) and kivy image module (kivy.uix.image)
Check this code:
from kivy.uix.image import Image, CoreImage
import io
binary_data= #binary img extracted from sqlite
data = io.BytesIO(binary_data)
img=CoreImage(data, ext="png").texture
new_img= Image()
new_img.texture= img

IOError: cannot identify image file when loading images from pdf files

I am trying to read scanned images from a pdf using wand and display it using PIL. But I get some error. First page of the pdf file works perfectly but the second page shows this error.
Code
from wand.image import Image
from wand.display import display
from PIL import Image as PI
import pyocr
import pyocr.builders
import io
import numpy as np
import cStringIO
tool = pyocr.get_available_tools()[0]
lang = tool.get_available_languages()[1]
req_image = []
final_text = []
image_pdf = Image(filename="DEEP_PLAST_20.700.pdf", resolution=200)
image_jpeg = image_pdf.convert('jpeg')
img_page = Image(image=image_jpeg.sequence[1])
img_buffer = np.asarray(bytearray(img_page.make_blob()), dtype=np.uint8)
print(img_buffer)
# im = PI.fromarray(img_buffer)
im = PI.open(cStringIO.StringIO(img_buffer))
I get this error.
Traceback (most recent call last):
File "ocr.py", line 43, in <module>
im = PI.open(cStringIO.StringIO(img_buffer))
File "/home/sahil/anaconda2/lib/python2.7/site-packages/PIL/Image.py", line 2452, in open
% (filename if filename else fp))
IOError: cannot identify image file <cStringIO.StringI object at 0x7fc4a8f168b0>
I don't why the code fails on the second page of the pdf whereas it works for the first one.
Any help would be appreciated!

Categories