[R] Colorspace: bug in HLS conversion?

Michael Gauland mikelygee at amuri.net
Wed Mar 12 23:41:55 CET 2014


I just started using the colorspace package, and converting between RGB and
HLS is not working as I expect.  In particular, converting RGB(0,0,0) to HLS
then back to RGB seems broken:

    #> as(as(RGB(0, 0, 0), "HLS"), "RGB")
	 R G B
    [1,] 1 1 0

That is, converting black to HLS then back again produces yellow!

Other values I've tried work as expected (i.e., I get the same RGB value out
as I put in).

Is this a bug in the code, or in my understanding of colour conversions?

Kind Regards,
Mike



More information about the R-help mailing list