title: A better Greyscale algorithm
body: <p>I'm trying to create a spectral image with a constant grey-scale value for every row. I've written some fantastically slow code that basically tries 1000 different variation between black and white for a given hue and it finds the one whose grey-scale value most closely approximates the target value, resulting in the following image:</p>
  
  <p><img src="https://i.stack.imgur.com/6bydR.png" alt="FarbenKugel"></p>
  
  <p>On my laptop screen (HP) there is a very noticeable 'dip' near the blue peak, where blue pixels near the bottom of the image appear much brighter than the neighbouring purple and cyan pixels. On my second screen (Acer, which has far superior colour display) the dip is smaller, but still there.</p>
  
  <p>I use the following function to compute the grey-scale approximation of a colour:</p>
  
  <pre><code>Math.Abs(targetGrey - (0.2989 * R + 0.5870 * G + 0.1140 * B))
  </code></pre>
  
  <p>when I convert the image to grey-scale using Paint.NET, I get a perfect black to white gradient, so that part of the code at least works.</p>
  
  <p>So, question: Is this purely an artefact of the display qualities of my screens? Or can the above mentioned grey-scale algorithm be improved upon to give a visually more consistent result?</p>
  
  <hr>
  
  <p>EDIT: The problem seems to be mostly monitor calibration. Not, I repeat not, a problem with the code. </p>