简体   繁体   中英

How convert ARGB to wavelenght(nanometers)?

I am searching method which allow me to convert ARGB(from BufferedImage.getRGB) to nanometers( wavelength of light). I know that it exist coz i saw programs which can do that.

Example Code

Example code that goes from rgba to wavelength can be found here . Disclaimer: I have not tried this code, I just found it on the interwebs.

For example code that goes from wavelength>RGB, see the question linked to by Mayo (relinked here ).

RGB and wavelength

If you're asking this question, you should probably make sure you understand the nuances of the relation between RGB and wavelength.

A color as perceived by our eye may be light of a single wavelength, or light of several wavelengths superimposed on one another to approximate the appearance of light of that single wavelength.

RGB treats colors as adding light of three specific wavelengths together to get the thing we perceive. So going from wavelength to RGB is asking the question: "How can we add red, green, and blue to approximate the appearance of this color?" There are many possible answers to this question.

Going from RGB to wavelength is asking the question (as you are) "What single wavelength light approximates the superposition of light given by these RGB values?". It's important to understand that you're working with a many to one mapping here.

**Here you can find another discussion of this along with a cool tool to help you check your work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM