SRM to RGB

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Chrslund

Member
Joined
Feb 26, 2011
Messages
19
Reaction score
1
Location
Littleton
Does anyone know a good way to relate SRM values to RGB values? I am writing a computer program and am trying to code a color display based on a calculated SRM.
 
Yes but it turns out to be more involved than you are probably aware of. The color one sees when actually looking at a beer depends on
1. The light transmission properties of the beer
2. The color of the light being used to observe the beer
3. The length of the path the light takes through the beer i.e. how wide the glass is
4. How close the beer is held to the observer's eye.

WRT 1: you need the absorption values at 81 wavelengths from 380 to 780 nm in 5 nm steps. SRM is a measure of the absorption at 1 wavelength (430 nm). The good news here is that beer absorption curves when normalized to the absorption at 430 nm are amazingly similar. This allows one to at least approximate the absorption spectrum of any beer whose SRM is known from just the SRM. But it should be obvious that a Kriek with an SRM of 12 does not look anything like an ale with an SRM of 12. Within even all malt beers there are also variations to the extent that a beer with a higher SRM value may actually appear lighter than one with a lower SRM value. Nevertheless the spectral approximation from SRM has been used to produce color guides such as the one offered by the BJCP.

With respect to 2: Beer appears to be a different color when viewed by tungsten light than it does when viewed by northern daylight at noon. The spectrum of the illuminating light must be known. Fortunately the spectra of the well known illuminants, in particular the D series, A and C are published (I'll tell you where to get them in a moment).

With respect to 3: Beer looks much yellower in a thin glass and redder in a wide one (mass) so the program must compensate for that. Most beer glasses are around 5 cm wide. If a beer is dark or if it is viewed in a wide glass the color becomes a very saturated red i.e. outside the gamut of what can be displayed on a computer monitor. This is a major problem in attempting to do what you want to do. Adobe RGB, the space used for most web application is really pretty small.

With respect to 4: This is not a major factor but to do what you want to do you will have to specify which of the two CIE 'observers', 10 ° ( close to your face) or 2 ° (arms length) you wish to use. 2 ° makes most sense to me but ASBC uses 10 ° in their tristimulus color method.

At www.wetnewf.org you will find some things on this subject. In particular there is a spreadsheet and a strawman ASBC MOA which taken together will allow you to do what you want to - at least it will allow you to calculate L*a*b* values (and from them Adobe and Rec. 709 RGB values) for any beer whose spectrum you have or any beer whose SRM you have in which case it will compute the values for an 'average' beer. The average was taken over an ensemble that included fruit beers so the average is not the average of malt beers but of beers in general. You can take this 'red' out by using a slightly negative first spectral deviation coefficient but you'll need to figure out how to use the spreadsheet to understand what that means.

All this is explained in detail in a companion paper which, as I assigned the copyright to ASBC, is not on the website. PM me with an e-mail address and I'll send you a .pdf.
 
Back
Top