GithubHelp home page GithubHelp logo

bitmaptodatabase's Introduction

This is an experiment. Would it make sense to make an image manipulation language? How about sql? What if you stored an image in a SQL database and manipulated it using standard SQL? Would this work?

This repo loads an image into a simple database.

CREATE TABLE imagedata ( imageid int(11) NOT NULL, x int(11) NOT NULL, y int(11) NOT NULL, r int(11) NOT NULL, g int(11) NOT NULL, b int(11) NOT NULL, a int(11) NOT NULL, PRIMARY KEY (imageid,x,y) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

You can store an image into the database by running

Usage: thelaboflieven.LoadIntoDatabase

Using this command you can store the image into the database.

Usage: thelaboflieven.StoreFromDatabase

Using this command you can retrieve the image from the database.

You can manipulate the image by using SQL queries:

-- greyscale of the image by taking the least value. INSERT INTO imagedata(imageid, x, y, r, g, b, a) SELECT 4 as imageid, x, y, least(r,g,b) as r, least(r,g,b) as g, least(r,g,b) as b , least(r,g,b) as a from imagedata where imageid=3;

-- greyscale of the image by taking the greatest value. INSERT INTO imagedata(imageid, x, y, r, g, b, a) SELECT 4 as imageid, x, y, greatest(r,g,b) as r, greatest(r,g,b) as g, greatest(r,g,b) as b , greatest(r,g,b) as a from imagedata where imageid=3;

-- increase brightness INSERT INTO imagedata(imageid, x, y, r, g, b, a) SELECT 4 as imageid, x, y, least(r+50,255) as r, least(g+50,255) as g, least(b+50,255) as b , least(a+50,255) as a from imagedata where imageid=3;

-- increase brightness INSERT INTO imagedata(imageid, x, y, r, g, b, a) SELECT 4 as imageid, x, y, least(r+50,255) as r, least(g+50,255) as g, least(b+50,255) as b , least(a+50,255) as a from imagedata where imageid=3;

bitmaptodatabase's People

Contributors

denshade avatar

Stargazers

Matthew Shirtliffe avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.