question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HSI out of bounds values and hue shifting

See original GitHub issue

The HSI conversion will take valid intensity values and convert them to RGB bytes > 255.

Also, shifting the intensity by a small amount can produce a rather large change in hue.

const cs = require('color-space');

console.log('HSI:');
let rgb1 = [ 0xb7, 0xc7, 0xff ];
let hsi = cs.rgb.hsi(rgb1);
let rgb2 = cs.hsi.rgb(hsi);
console.log(`     from RGB ${round(rgb1)} to HSI ${round(hsi)}`);
console.log(`  back to RGB ${round(rgb2)}`);
hsi[2] += 6;
let rgb3 = cs.hsi.rgb(hsi);
console.log(`  i+=6 to RGB ${round(rgb3)}`);

function round(vals) {
    return [Math.round(vals[0]), Math.round(vals[1]), Math.round(vals[2])];
}

Yields:

HSI:
     from RGB 183,199,255 to HSI 228,14,212
  back to RGB 183,199,255
  i+=6 to RGB 188,205,262

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jtlappcommented, Nov 9, 2017

There are so many ways to express this conversion, I’m not finding the algorithm you modeled. I’m coding it from scratch to see if I get better behavior. Will share when I’m done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble with HSI->RGB conversion - c++ - Stack Overflow
The basic idea here is the shift from 0 - 360 on the hue value which will result in rgb values. We also...
Read more >
Unit 8. Processing Color Images
Together, HSI (hue, saturation and intensity) make any color and intensity of light. ... color values in the usual manner of image processing,...
Read more >
HSL and HSV - Wikipedia
HSL (for hue, saturation, lightness) and HSV are alternative representations of the RGB color model, designed in the 1970s by computer graphics researchers ......
Read more >
HSI color model. Hue represents the feeling of human sense ...
HSI color model. Hue represents the feeling of human sense to different colors. Saturation indicates the purity of the color that means the...
Read more >
Hue, Saturation, And Intensity Aresi In HSI Color Model | Cram
Hue, Saturation, and Intensity are represented as HSI in HSI colour model. The HSI model is used as an alternative to, or alongside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found