All Projects → SparrowDb → sparrowdb

SparrowDb / sparrowdb

Licence: MIT license
SparrowDB is an image database that works like an append-only object store. Sparrow has tools that allow image processing and HTTP server to access images

Programming Languages

go
31211 projects - #10 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to sparrowdb

hermitage
Service that provides storage, delivery and modification of your images
Stars: ✭ 33 (-43.1%)
Mutual labels:  imageserver
hermitage-skeleton
Hermitage Skeleton
Stars: ✭ 16 (-72.41%)
Mutual labels:  imageserver
Google Images Download
Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!
Stars: ✭ 7,815 (+13374.14%)
Mutual labels:  image-database
pigallery
PiGallery: AI-powered Self-hosted Secure Multi-user Image Gallery and Detailed Image analysis using Machine Learning, EXIF Parsing and Geo Tagging
Stars: ✭ 35 (-39.66%)
Mutual labels:  image-database

Golang logo

GoDoc Build Status Go Report Card

Whats is SparrowDB?

SparrowDB is an image database that works like an append-only object store. Sparrow has tools that allow image processing and HTTP server to access images.

Sparrow Object Store

Sparrow consists of three files – the actual Sparrow store file containing the images data, plus an index file and a bloom filter file.

There is a corresponding data definition record followed by the image bytes for each image in the storage file. The index file provides the offset of the data definition in the storage file.

Features

  1. Built-in HTTP API so you don't have to write any server side code to get up and running.
  2. Optimizations for image storing.
  3. Web Admin Panel.
  4. Create scripts with Lua for image processing.

Getting started

This short guide will walk you through getting a basic server up and running, and demonstrate some simple reads and writes.

Using Sparrow

Creating a database:

curl -X PUT http://127.0.0.1:8081/api/database_name

Show databases:

curl -X GET http://127.0.0.1:8081/api/_all

Sending an image to database:

curl -i -X PUT -H "Content-Type: multipart/form-data"  \
    -F "[email protected]" \
    http://127.0.0.1:8081/api/database_name/image_key

Querying an image:

curl -X GET http://127.0.0.1:8081/api/database_name/image_key

Accessing image from browser:

http://localhost:8081/g/database_name/image_key

Token

If is set in database configuration file, generate_token = true, SparrowDB will generate a token for each image uploaded. The token’s value is randomly assigned by and stored in database. The token effectively eliminates attacks aimed at guessing valid URLs for photos.

Accessing image from browser with token:

http://localhost:8081/g/database_name/image_key/token_value

Image Processing

SparrowDB uses bild to allow image processing using LUA script.

All SparrowDB scripts must be in 'scripts' folder.

Example of script with image effect:

-- If image name contains gray, use grayscale effect
if string.match(imageCtx:name(), "gray") then
    imageCtx:grayscale()
end

-- If image name contains blue, use gaussian blur effect
if string.match(imageCtx:name(), "blur") then
    imageCtx:gaussianBlur(3.0)
end

Example of script with pixel iteration:

-- create an editable image
p = sparrowRGBA.new(imageCtx)

-- get image bounds
b = p:bounds()

-- iterate over pixels
for i = 0, b['width'] do
    for j = 0, b['height'] do
        -- get current pixel color: red, green, blue, alpha
        v = p:getPixel(i, j)

        -- set current pixel color: red, green, blue, alpha
        p:setPixel(i, j, v['red'], v['green'], v['blue'], v['alpha'])
    end
end

-- set processed image as outputsss
imageCtx:setOutput(p)

License

This software is under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].