Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/apply-cube-lut
Apply a Cube (IRIDAS/Adobe) LUT to an image
https://github.com/thibauts/apply-cube-lut
Last synced: 2 months ago
JSON representation
Apply a Cube (IRIDAS/Adobe) LUT to an image
- Host: GitHub
- URL: https://github.com/thibauts/apply-cube-lut
- Owner: thibauts
- License: mit
- Created: 2015-10-03T18:39:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-11-08T04:04:38.000Z (about 3 years ago)
- Last Synced: 2024-11-01T01:53:05.526Z (2 months ago)
- Language: JavaScript
- Size: 87.9 KB
- Stars: 35
- Watchers: 8
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
apply-cube-lut
==============
### Apply a Cube (IRIDAS/Adobe) LUT to an imageApplies a Cube LUT to an image. See [parse-cube-lut](https://github.com/thibauts/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
-------```bash
$ npm install apply-cube-lut
```Usage
-----```javascript
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();
```