Simple to use image handler for python sqlite3.

Overview

SQLite Image Handler

Simple to use image handler for python sqlite3.

Functions

Function Name Parameters Returns
init databasePath : str
tableName : str
-
startConnection - -
imageSelector path : str bytesContent : bytes
extensionType : str
addImage imageName : str
imageBytes : bytes
extensionType : str
-
getSaveImage imageName : str
savePath : str
-
isImageExists imageName : str isExists : bool
deleteImage imageName : str -
updateImage imageName : str
newImageBytes : bytes
newExtensionType : str
-

See definitions

Usage

  • Importing & Creating Handler

from SQLiteImageHandler.SQLiteImageHandler import ImageHandler

handler = ImageHandler(databasePath = "database.db", tableName = "myimages")

  • Adding an image to the database

handler.addImage(imageName = "Image 1", *handler.imageSelector(path = r"C:\Users\mozancetin\Desktop\myimage1.png"))

  • Saving image from database to computer

# If you want, use a save name like "savedImage" instead of "savedImage.png"
# ..because whatever you write, it will automatically fetch the extension from the database.
handler.getSaveImage(imageName = "Image 1", savePath = r"C:\Users\mozancetin\Desktop\savedImage.png")

  • Updating the image in the database

handler.updateImage(imageName = "Image 1", *handler.imageSelector(path=r"C:\Users\mozancetin\Desktop\myimage2.png"))

  • Deleting an image from database

handler.deleteImage(imageName = "Image 1")

  • Check if image exists in the database

isExists = handler.isImageExists(imageName = "Image 1")
print(isExists)

  • Get bytes of image and extension type

bytesOfImage, extensionType = handler.imageSelector(path=r"C:\Users\mozancetin\Desktop\myimage1.png")
print("Bytes Length: " + str(len(bytesOfImage)) + "\nExtension Type: " + extensionType)


Definitions

init(self,databasePath : str = "database.db", tableName : str = "images") -> None

  • Sets the self.databasePath, self.tableName and calls startConnection() func.

startConnection(self) -> None

  • Starts the connection with SQLite Database.

imageSelector(self, path : str = None) -> bytesContent[bytes], extensionType[str]

  • Selects an image and returns the image's bytes content and extension type.
  • bytesContent[bytes]: Bytes content of image.
  • extensionType[str]: Extension type like png, jpg or something...

addImage(self, imageName : str, imageBytes : bytes, extensionType : str = "png") -> None

  • Adds an image to database.

getSaveImage(self, imageName : str = None, savePath : str = "savedImage") -> None

  • Saves the previously saved image in the database as an image to the given path.

isImageExists(self, imageName : str = None) -> isExists[bool]

  • Checks if image exists in database by image name.
  • isExists[bool]: True if image exists in the database otherwise False

deleteImage(self, imageName : str = None) -> None

  • Deletes image by name in database.

updateImage(self, imageName : str = None, newImageBytes : bytes = None, newExtensionType : str = None) -> None

  • Updates image by name in database.


CMD Things

C:\Users\mozancetin\Desktop\Handler>python SQLiteImageHandler

usage: SQLiteImageHandler [-h] [-v] [--database-path DBPATH] [--table-name TABLENAME] [-a] [-sn SAVE_NAME]
                          [-ip IMAGE_PATH] [-s] [-sdn SAVED_NAME] [-sp SAVE_PATH] [-u] [-in IMAGE_NAME]
                          [-uip UPDATE_IMAGE_PATH] [-d] [-c] [-is]

SQLite Image Handler.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --database-path DBPATH
                        database path.
  --table-name TABLENAME
                        table name of the database

Add an Image:
  Adding an image to the database.

  -a, --add-image       Adds an image to database. (Requires -sn and -ip)
  -sn SAVE_NAME, --save-name SAVE_NAME
                        Save name of image.
  -ip IMAGE_PATH, --image-path IMAGE_PATH
                        Path of the selected image

Save an Image:
  Saving image from database to computer.

  -s, --save-image      Saves the previously saved image in the database as an image to the given path. (Requires -sdn
                        and -sp)
  -sdn SAVED_NAME, --saved-name SAVED_NAME
                        Saved name of image in the database.
  -sp SAVE_PATH, --save-path SAVE_PATH
                        Save path. (default: savedImage.png)

Update an Image:
  Updating the image in the database.

  -u, --update-image    Updates image by name in database. (Requires -in and -uip)
  -in IMAGE_NAME, --image-name IMAGE_NAME
                        Saved name of image in the database.
  -uip UPDATE_IMAGE_PATH, --update-image-path UPDATE_IMAGE_PATH
                        Path of the selected image

Delete an Image:
  Deleting an image from database

  -d, --delete          Deletes image by name in database. (Requires -in)

Other:
  -c, --check           Checks if image exists in database by image name. (Requires -in)
  -is, --image-selector
                        Selects an image and returns the image's bytes length and extension type. (Requires -ip)

TODO's

  • Write a readme file
  • Add different types of images (Right now just png is supported)
  • Add more explanation to functions
  • Add deletePhoto, updatePhoto functions
  • Raise some errors
  • Add Usage to readme
  • Upload to pypi
  • Write a description of each function for README
  • Add some cmd things
You might also like...
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

GTK and Python based, simple multiple image editor tool
GTK and Python based, simple multiple image editor tool

System Monitoring Center GTK3 and Python3 based, simple multiple image editor tool. Note: Development of this application is not completed yet. The ap

An open source image editor which can manipulate an image in many ways!

Image Editor - An open source image editor which can manipulate an image in many ways! If you need any more modes in repo or I

Image enhancing model for making a blurred image to be somehow clearer than before

This is a very small prject which helps in enhancing the images by taking a Input images. This project has many features like detcting the faces and enhaning the faces itself and also a feature which enhances the whole image

Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.
Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.

img2dataset Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine. Also supports

This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious
This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious

Offline Reverse Image Search Overview This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specia

Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image

Face-Detacher Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image This is a small python scrip

Fast Image Retrieval is an open source image retrieval framework

Fast Image Retrieval is an open source image retrieval framework release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This framework implements most of the major binary hashing methods, together with both popular backbone networks and public datasets.

Fast Image Retrieval (FIRe) is an open source image retrieval project

Fast Image Retrieval (FIRe) is an open source image retrieval project release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This project implements most of the major binary hashing methods to date, together with different popular backbone networks and public datasets.

Releases(1.0.0)
kikuchipy is an open-source Python library for processing and analysis of electron backscatter diffraction (EBSD) patterns

kikuchipy is an open-source Python library for processing and analysis of electron backscatter diffraction (EBSD) patterns. The library builds on the

pyxem 53 Dec 29, 2022
AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

Satya Mohapatra 18 Nov 13, 2022
Craft PNG files that appear completely different in Apple software

Ambiguous PNG Packer Craft PNG files that appear completely different in Apple software

David Buchanan 1k Dec 29, 2022
Steganography Image/Data Injector.

Byte Steganography Image/Data Injector. For artists or people to inject their own print/data into their images. TODO Add more file formats to support.

Ori 4 Nov 16, 2022
Python implementation of image filters (such as brightness, contrast, saturation, etc.)

PyPhotoshop Python implementation of image filters Use Python to adjust brightness and contrast, add blur, and detect edges! Follow along tutorial: ht

Kylie 87 Dec 15, 2022
GTK and Python based, simple multiple image editor tool

System Monitoring Center GTK3 and Python3 based, simple multiple image editor tool. Note: Development of this application is not completed yet. The ap

Hakan Dündar 1 Feb 02, 2022
Converting Images Into Minecraft Houses

Converting Images Into Minecraft Houses In this particular project, we turned a 2D Image into Minecraft pixel art and then scaled it in 3D such that i

Mathias Oliver Valdbjørn Jørgensen 1 Feb 02, 2022
LabelMe annotation tool source code

LabelMe annotation tool source code Here you will find the source code to install the LabelMe annotation tool on your server. LabelMe is an annotation

MIT CSAIL Computer Vision 1.3k Jan 03, 2023
A scalable implementation of WobblyStitcher for 3D microscopy images

WobblyStitcher Introduction A scalable implementation of WobblyStitcher Dependencies $ python -m pip install numpy scikit-image Visualization ImageJ

CSE Lab, ETH Zurich 7 Jul 25, 2022
Group of interfaces interesting for users

Project: Interface to create GIF animation based on Fourier Series.

5 Aug 17, 2021
Photini - A free, easy to use, digital photograph metadata (Exif, IPTC, XMP) editing application for Linux, Windows and MacOS.

A free, easy to use, digital photograph metadata (Exif, IPTC, XMP) editing application for Linux, Windows and MacOS. "Metadata" is said to mea

Jim Easterbrook 120 Dec 20, 2022
An add to make adding screenshots and copied images to the scene easy

Blender Clipboard to Scene It doesn't work with version 2.93 and higher (I tested it on 2.91 and 2.83) There is an issue with importing the Pillow mod

Mohammad Mehdi Afkhami 3 Dec 29, 2021
Computer art based on joining transparent images

Computer Art There is no must in art because art is free. Introduction The following tutorial exaplains how to generate computer art based on a series

Computer Art 12 Jul 30, 2022
Image enhancing model for making a blurred image to be somehow clearer than before

This is a very small prject which helps in enhancing the images by taking a Input images. This project has many features like detcting the faces and enhaning the faces itself and also a feature which

3 Dec 03, 2021
Simple program to easily view Euler parameters in 3D.

Simple program to easily view Euler parameters in 3D.

5 Aug 20, 2021
A collection of python scripts which help you programatically create PNGs or GIFs

A collection of python scripts which help you programatically create PNGs or GIFs and their Metadata in bulk with custom rarity rates, upload them to OpenSea & list them for sale.

Tom 30 Dec 24, 2022
Computer art based on quadtrees.

Quads Computer art based on quadtrees. The program targets an input image. The input image is split into four quadrants. Each quadrant is assigned an

Michael Fogleman 1.1k Dec 23, 2022
Python Image Optimizer Script

Image-Optimizer Download and Install git clone https://github.com/stefankumpan/Image-Optimizer-Script.git cd Image-Optimizer-Script pip install -r req

Stefan Kumpan 0 Jul 15, 2021
View images in the terminal using ansi escape codes and python

terminal-photo-viewer view images in the terminal using ansi escape codes and python !! Only tested on Ubuntu 20.04.3 LTS with python version 3.8.10 D

1 Nov 30, 2021
Bot by image recognition simulating (random) human clicks

bbbot22 bot por reconhecimento de imagem simulando cliques humanos (aleatórios) inb4: sim, esse é basicamente o mesmo bot de 2021 porque a Globo não t

Yuri 2 Apr 05, 2022