Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apply-cube-lut

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apply-cube-lut

Apply a Cube (IRIDAS/Adobe) LUT to an image

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by22.86%
Maintainers
1
Weekly downloads
 
Created
Source

apply-cube-lut

Apply a Cube (IRIDAS/Adobe) LUT to an image

Applies a Cube LUT to an image. See parse-cube-lut for Cube LUT parsing.

LUT files are useful for color grading, encapsulating complex color-space transforms or emulating film stock for photography and video.

Example

Photograph transformed with a Fuji 400H stock emulation LUT.

Install

$ npm install apply-cube-lut

Usage

var applyCubeLUT = require('apply-cube-lut');
var parseCubeLUT = require('parse-cube-lut');
var ndarrayFromImage  = require('ndarray-from-image');
var canvasFromNdarray = require('canvas-from-ndarray');
var ops = require('ndarray-ops');

var lutURL = 'test.cube';
var imgURL = 'test.jpg';

var req = new XMLHttpRequest();
var img = new Image();

req.onload = function() {
  img.onload = function() {

    // once both the image and LUT data are loaded
    var lut = parseCubeLUT(req.responseText);
    var arr = ndarrayFromImage(img, 'float32');

    // convert RGBA components to 0.0 -> 1.0
    ops.mulseq(arr, 1.0 / 255.0);

    // apply LUT
    applyCubeLUT(arr /* dest */, arr /* src */, lut);

    // convert back to 0.0 -> 255.0
    ops.mulseq(arr, 255.0);

    // display transformed image
    var canvas = canvasFromNdarray(arr);
    document.body.appendChild(canvas);
  };
  
  img.src = imgURL;
};

req.open('GET', lutURL, true);
req.send();

Keywords

FAQs

Package last updated on 03 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc