Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the formula to increase the luminance in an image in a similar way how the L component in Photoshop does it?
    text
    copied!<p>For example I have a pixel with these values:</p> <pre><code>CGFloat red = 34 // 0 - 255 CGFloat green = 128 CGFloat blue = 190 </code></pre> <p>and I want to increase luminance so that blue is 255. NOTE: With "Luminance" I mean the L-component of Photoshop in LAB color space. See pictures!</p> <p>There must be a special formula to compute the RGB values for the increased luminance, because the R G B values are modified in a non-linear way!</p> <p>Proof: I did a test in Photoshop and created this same color, and then opened the color picker to examine it:</p> <p><img src="https://i.stack.imgur.com/0yQxv.png" alt="Original color"></p> <p>Then I activated the L component of the LAB color space, which controls luminance (at least that is what I am talking about - I mean the brightness controlled by that L component. Guess that is luminance).</p> <p>So with L activated, I dragged the slider on the left upwards until B reached 255: <img src="https://i.stack.imgur.com/XQDcq.png" alt="Modified color"></p> <p>Now read the resulting R G B values:</p> <pre><code>CGFloat newRed = 112 // 0 - 255 CGFloat newGreen = 188 CGFloat newBlue = 255 </code></pre> <p>The differences between these is:</p> <pre><code>newRed - red = +78 newGreen - green = +60 newBlue - blue = +65 </code></pre> <p>The percentages are:</p> <pre><code>red shift: +38.42% green shift: +29.55% blue shift: +32.01% </code></pre> <p>This does not correspond with the known formula for computing Luminance out of R G B, which is something close to <code>luminance = (red * 0.3) + (green * 0.6) + (blue * 0.1)</code>.</p> <p>Obviously, they have been shifted in a non-linear manner.</p> <p>Is there a known way to compute newRed, newGreen, newBlue out of red, green, blue in a similar fashion how Photoshop does it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload