Giter Club home page Giter Club logo

exposure's Introduction

Demo

Overview

Exposure allows fast image processing in the browser backed by webGL. Right now even with just brightness, contrast, and levels implemented a range of effects can be achieved. Everything from HDR to instagram like filters.

You supply the img to be filtered, output will be to canvas.

Install

$ npm install --save exposure

Usage

var Exposure = require('exposure');

var exposure = new Exposure(img, {
  json: json,     // settings json can be created on the demo page
  canvas: canvas, // if a canvas is on the page output can be drawn there
  callback: function(exposure) {
    exposure.settings; // can be manipulated to dynamically update image
    exposure.canvas; // reference to the canvas that has the output on it
  }
});

Image size

The max image size dimension currently supported by exposure is 2500. If a side is over this length the img passed in will be downscaled.

Settings JSON

The filter exposure renders is controlled by a json containing all the information in it. You can generate a json by visiting this link. You can also initialize frame without a json and then manipulate it live yourself.

var exposure = new Exposure(img);
var settings = exposure.settings;

settings.brightness = 1.3; // frame will automatically draw when settings has been updated. 
JSON.stringify(settings.json);

Contributing

A good place to make or test changes would be the demo app.

git clone [email protected]:actionnick/exposure.git
cd exposure
npm install
grunt demo_watch

in a different tab...

npm start

Then localhost:8000 should be running the demo page and the grunt command will be rebuilding whenever a shader or js file is changed.

Adding a new effect should be relatively simple. First add the properties that will control the effect to ExposureSettings.PROPS in src/exposure_settings. These names correspond to the uniforms that get passed into the main fragment shader that renders the filter, src/shaders/exposure.frag.

After the props have been added to ExposureSettings.PROPS add the necessary code to exposure.frag to actually implement your shader.

To test it you can actually just do something like frame.settings.new_prop = 3 or you can add some controls for it in the demo.

License

MIT © Nick Schaubeck

Thank you Shauna Leytus for the logo!

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.