Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:scriptsamples:grayscale [2015/09/14]
127.0.0.1 external edit
developer:scriptsamples:grayscale [2015/12/03] (current)
sandy
Line 1: Line 1:
 ====== Convert Colors to Grayscales ====== ====== Convert Colors to Grayscales ======
 > **Developer:​** //​[[developer:​rhinoscript|RhinoScript]]//​ > **Developer:​** //​[[developer:​rhinoscript|RhinoScript]]//​
-> **Summary:​** //​Demonstrates how to convert an RGB color value to grayscale.//+> **Summary:​** //​Demonstrates how to convert an RGB color value to grayscale//
  
 ===== Question ===== ===== Question =====
-I would like to convert all of the layers in a document from color to grayscale. Is there a way I can do this with RhinoScript?​+I would like to convert all the layers in a document from color to grayscale. Is there a way I can do this with RhinoScript?​
  
 ===== Answer ===== ===== Answer =====
-To convert any color to a grayscale representation of its luminance, ​first one must obtain the values of its red, green, and blue (RGB) primaries in linear intensity encoding, by gamma expansion. Then, add together 30% of the red value, 59% of the green value, and 11% of the blue value. The resultant ​number is the desired linear luminance valueit typically ​needs to be gamma compressed to get back to a conventional grayscale representation.+To convert any color to a grayscale representation of its luminance, ​you must first obtain the values of its red, green, and blue (RGB) primaries in linear intensity encoding, by gamma expansion. Then, add together 30% of the red value, 59% of the green value, and 11% of the blue value. The resulting ​number is the desired linear luminance value. Typically, ​it needs to be gamma compressed to get back to a conventional grayscale representation.
  
 ===== Example ===== ===== Example =====
developer/scriptsamples/grayscale.txt ยท Last modified: 2015/12/03 by sandy