npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cube-lut-factory

v0.1.1

Published

Cube LUT file utils

Downloads

8

Readme

Cube LUT factory

Useful function to deal with Cube LUT files.

Install

$ npm install cube-lut-factory

Usage

const cubeLUT = require("cube-lut-factory");

Parse

// Parse Cube LUT content
const cubeLUT = require("cube-lut-factory");

let fs = require("fs");
let lutContent = fs.readFileSync("test/1DLUT.cube");
let lutObject = cubeLUT.parse(lutContent);

console.log(lutObject);
{
  title: "1D Identity Cube LUT",
  type: "1D",
  size: 4,
  domainMin: [0, 0, 0],
  domainMin: [1, 1, 1],
  dataPoints: [
    [0.0000, 0.0000, 0.0000],
    [0.3333, 0.3333, 0.3333],
    [0.6667, 0.6667, 0.6667],
    [1.0000, 1.0000, 1.0000],
  ]
}

Generate

  • header: Includes a header on the beginning of the file. (optional)
  • title: Defines the title. (mandatory)
  • type: Defines the type (1D or 3D). (mandatory)
  • size: Defines the size. (mandatory)
  • domainMin and domainMax: Vector of 3 values, containing the minimum and maximum of the domain, respectively.
  • R, G and B: Defines the function of each channel. If the type is 1D, it must be in function of the single variable t (R(t), G(t), B(t)). If the type is 3D, it must be in function of the three variable r, g and b (R(r, g, b), G(r, g, b), B(r, g, b)).
// Generate Cube LUT content
const cubeLUT = require("cube-lut-factory");

let lutObject = {
  title: "Test",
  type: "3D",
  size: 4,
  domainMin: [0, 0, 0],
  domainMax: [1, 1, 1],
  R: "(r^2 + g*b)/2",
  G: "(g^3 + r*2*b)/3",
  B: "(b^4 + r + b)/3",
};

let lutContent = cubeLUT.generate(lutObject);

console.log(lutContent);
# Cube LUT file generated with cube-lut-factory
# https://github.com/diegoinacio/cube-lut-factory.js
TITLE "Test"

# Cube LUT size
LUT_3D_SIZE 4

# Cube LUT domain
DOMAIN_MIN 0 0 0
DOMAIN_MAX 1 1 1

# Cube LUT data points
0 0 0
0.05555555555555555 0 0.1111111111111111
0.2222222222222222 0 0.2222222222222222
0.5 0 0.3333333333333333
0 0.012345679012345677 0
0.05555555555555555 0.012345679012345677 0.1111111111111111
0.2222222222222222 0.012345679012345677 0.2222222222222222
0.5 0.012345679012345677 0.3333333333333333
0 0.09876543209876541 0
0.05555555555555555 0.09876543209876541 0.1111111111111111
0.2222222222222222 0.09876543209876541 0.2222222222222222
0.5 0.09876543209876541 0.3333333333333333
0 0.3333333333333333 0
0.05555555555555555 0.3333333333333333 0.1111111111111111
0.2222222222222222 0.3333333333333333 0.2222222222222222
0.5 0.3333333333333333 0.3333333333333333
0 0 0.11522633744855966
0.05555555555555555 0.07407407407407407 0.22633744855967075
0.2222222222222222 0.14814814814814814 0.33744855967078186
0.5 0.2222222222222222 0.448559670781893
0.05555555555555555 0.012345679012345677 0.11522633744855966
0.1111111111111111 0.08641975308641975 0.22633744855967075
0.2777777777777778 0.16049382716049382 0.33744855967078186
0.5555555555555556 0.23456790123456786 0.448559670781893
0.1111111111111111 0.09876543209876541 0.11522633744855966
0.16666666666666666 0.17283950617283947 0.22633744855967075
0.3333333333333333 0.24691358024691357 0.33744855967078186
0.6111111111111112 0.3209876543209876 0.448559670781893
0.16666666666666666 0.3333333333333333 0.11522633744855966
0.2222222222222222 0.40740740740740744 0.22633744855967075
0.38888888888888884 0.48148148148148145 0.33744855967078186
0.6666666666666666 0.5555555555555555 0.448559670781893
0 0 0.28806584362139914
0.05555555555555555 0.14814814814814814 0.3991769547325103
0.2222222222222222 0.2962962962962963 0.5102880658436214
0.5 0.4444444444444444 0.6213991769547325
0.1111111111111111 0.012345679012345677 0.28806584362139914
0.16666666666666666 0.16049382716049382 0.3991769547325103
0.3333333333333333 0.30864197530864196 0.5102880658436214
0.6111111111111112 0.4567901234567901 0.6213991769547325
0.2222222222222222 0.09876543209876541 0.28806584362139914
0.2777777777777778 0.24691358024691357 0.3991769547325103
0.4444444444444444 0.3950617283950617 0.5102880658436214
0.7222222222222222 0.5432098765432098 0.6213991769547325
0.3333333333333333 0.3333333333333333 0.28806584362139914
0.38888888888888884 0.48148148148148145 0.3991769547325103
0.5555555555555556 0.6296296296296297 0.5102880658436214
0.8333333333333333 0.7777777777777777 0.6213991769547325
0 0 0.6666666666666666
0.05555555555555555 0.2222222222222222 0.7777777777777777
0.2222222222222222 0.4444444444444444 0.8888888888888888
0.5 0.6666666666666666 1
0.16666666666666666 0.012345679012345677 0.6666666666666666
0.2222222222222222 0.23456790123456786 0.7777777777777777
0.38888888888888884 0.4567901234567901 0.8888888888888888
0.6666666666666666 0.6790123456790124 1
0.3333333333333333 0.09876543209876541 0.6666666666666666
0.38888888888888884 0.3209876543209876 0.7777777777777777
0.5555555555555556 0.5432098765432098 0.8888888888888888
0.8333333333333333 0.7654320987654321 1
0.5 0.3333333333333333 0.6666666666666666
0.5555555555555556 0.5555555555555555 0.7777777777777777
0.7222222222222222 0.7777777777777777 0.8888888888888888
1 1 1