lib/color_lib/cmyk.rb
# Converts the CMYK colour to a single greyscale value. There are
# undoubtedly multiple methods for this conversion, but only a minor
# variant of the Adobe conversion method will be used:
#
#   g = 1.0 - min(1.0, 0.299 * c + 0.587 * m + 0.114 * y + k)
#
# This treats the CMY values similarly to YIQ (NTSC) values and then adds
# the level of black. This is a variant of the Adobe version because it
# uses the more precise YIQ (NTSC) conversion values for Y (intensity)
# rather than the approximates provided by Adobe (0.3, 0.59, and 0.11).
Converts the CMYK colour to a single greyscale value. There are
undoubtedly multiple methods for this conversion, but only a minor
variant of the Adobe conversion method will be used.



This treats the CMY values similarly to YIQ (NTSC) values and then adds
the level of black. This is a variant of the Adobe version because it
uses the more precise YIQ (NTSC) conversion values for Y (intensity)
rather than the approximates provided by Adobe (0.3, 0.59, and 0.11).
Converts the CMYK colour to a single greyscale value . There are undoubtedly multiple methods for this conversion but only a minor variant of the Adobe conversion method will be used . This treats the CMY values similarly to YIQ ( NTSC ) values and then adds the level of black . This is a variant of the Adobe version because it uses the more precise YIQ ( NTSC ) conversion values for Y ( intensity ) rather than the approximates provided by Adobe ( 0 . 3 0 . 59 and 0 . 11 ) .
def to_grayscale
    c = 0.299 * @c.to_f
    m = 0.587 * @m.to_f
    y = 0.114 * @y.to_f
    g = 1.0 - [1.0, c + m + y + @k].min
    ColorLib::GrayScale.from_fraction(g)
  end
def to_grayscale c = 0.299 * @c . to_f m = 0.587 * @m . to_f y = 0.114 * @y . to_f g = 1.0 - [ 1.0 , c + m + y + @k ] . min ColorLib :: GrayScale . from_fraction ( g ) end
Converts the CMYK colour to a single greyscale value.
Converts the CMYK colour to a single greyscale value .