GithubHelp home page GithubHelp logo

lens's Introduction

lerna code style: prettier build status

Work in progress

Lens

Lens are a series of modules to apply image filters on the browser while levaraging image-filters.

You can install and use a filter directly or you can use the chainable module to help you chain multiple filters and apply them to your DOM.

List of available filters:

How to create new filters?

A filter is a function that receives:

  • data - Array - Array with the image data
  • options - Object - Any options you need to apply your transformation
  • nWorkers - Number - The number of workers to be used

In this function you return the call to lens-core's applyFilter function while passing in the data, a transform function, the options and the nWorkers.

The transform function is where you really define your filter, it receives the data, length of the array to be transformed and the options and should return the array of the data transformed.

Here is a simple example of brightness transformer:

import { applyFilter } from 'lens-core';

const transform = ({ data, length, options }) => {
    for (let i = 0; i < length; i += 4) {
        data[i] += options.level;
        data[i + 1] += options.level;
        data[i + 2] += options.level;
    }

    return data;
};

export default brightness = ({ data, options, nWorkers } = {}) => 
    applyFilter({ data, transform, options, nWorkers });

lens's People

Contributors

canastro avatar

Stargazers

Renan avatar

Watchers

James Cloos avatar  avatar

lens's Issues

Uglify dists

  • chainable
  • brightness
  • color
  • colorize
  • contrast
  • core
  • gamma
  • grayscale
  • invert
  • noise
  • sepia
  • threshold

Improve jsdocs

  • chainable
  • brightness
  • color
  • colorize
  • contrast
  • core
  • gamma
  • grayscale
  • invert
  • noise
  • sepia
  • threshold

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.