[R] Colorspace: bug in HLS conversion?

Pascal Oettli kridox at ymail.com
Thu Mar 13 09:36:25 CET 2014


Hi,

I cannot reproduce your result:

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

You probably should provide the output of sessionInfo().

Regards,
Pascal



On Thu, Mar 13, 2014 at 7:41 AM, Michael Gauland <mikelygee at amuri.net> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan




More information about the R-help mailing list