import sqlite3conn=sqlite3.connect('facial.db')cursor = conn.cursor()#=========================Insert Photos =======================# Convert digital data to binary formatdef convertToBinaryData(images): for images in Directory: with open(images, 'wb') as f: photo = f.read() name= "Pix"+1 cursor.execute("""INSERT INTO faces_file (name, photo) VALUES (?,?) """,(name,photo)
Note: If you do store BLOBs in Sqlite3 https://www.sqlite.org/limits.html states max size is 2G, which is likely sufficient for any image + best to keep this limit in mind.