In colorspace.R I see:
setAs("color", "LAB", function(from)
LAB(.Call("as_LAB", from at coords, class(from), .WhitePoint,
PACKAGE = "
colorspace"),
names = dimnames(from at coords)[[1]]))
...
.WhitePoint = NULL
and then in colorspace.c and the function CheckWhite(),
I see that .WhitePoint = NULL is converted to D65.
I would like to pass a different .WhitePoint to
as( XYZ( 100,100,100) , "LAB" )
I have tried 3 methods:
as( XYZ( 100,100,100) , "LAB", .WhitePoint=XYZ(95,100,105) )
.WhitePoint = XYZ(95,100,105)
assign( ".WhitePoint", XYZ(95,100,105),
env=as.environment('package:
colorspace') )
but all fail, for different reasons.
How can I transform XYZ to LAB using a whitepoint different than D65 ?
Thanks,
Glenn Davis
gdavis at gluonics.com
[[alternative HTML version deleted]]
Glenn,
currently, this is currently not exposed in "colorspace" AFAICS. You
can
modify it by changing .WhitePoint inside colorspace's NAMESPACE, though:
R> assignInNamespace(".WhitePoint", rbind(c(95, 100, 105)),
+ ns = "colorspace")
R> as(XYZ(100, 100, 100), "LAB")
L A B
[1,] 100 8.622384 3.226371
I'll have another look whether this could be exposed easily (cc also
Paul).
Best,
Z
On Mon, 4 Jun 2018, Glenn Davis wrote:
> In colorspace.R I see:
>
> setAs("color", "LAB", function(from)
> LAB(.Call("as_LAB", from at coords, class(from),
.WhitePoint, PACKAGE = "
> colorspace"),
> names = dimnames(from at coords)[[1]]))
> ...
> .WhitePoint = NULL
>
> and then in colorspace.c and the function CheckWhite(),
> I see that .WhitePoint = NULL is converted to D65.
>
> I would like to pass a different .WhitePoint to
> as( XYZ( 100,100,100) , "LAB" )
>
>
> I have tried 3 methods:
> as( XYZ( 100,100,100) , "LAB", .WhitePoint=XYZ(95,100,105) )
> .WhitePoint = XYZ(95,100,105)
> assign( ".WhitePoint", XYZ(95,100,105),
env=as.environment('package:
> colorspace') )
> but all fail, for different reasons.
>
> How can I transform XYZ to LAB using a whitepoint different than D65 ?
>
> Thanks,
> Glenn Davis
> gdavis at gluonics.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
As a follow-up to this issue:
A revised version of the "colorspace" package is now available on
R-Forge
at https://R-Forge.R-project.org/R/?group_id=20
This provides a function whitepoint() that can query and/or modify the
whitepoint used in all color conversions within the package. To try it you
can do:
install.packages("colorspace",
repos="http://R-Forge.R-project.org")
example("whitepoint", package = "colorspace")
Glenn, it would be great if you could try this and let us know if any
problems remain.
On Mon, 4 Jun 2018, Achim Zeileis wrote:
> Glenn,
>
> currently, this is currently not exposed in "colorspace" AFAICS.
You can
> modify it by changing .WhitePoint inside colorspace's NAMESPACE,
though:
>
> R> assignInNamespace(".WhitePoint", rbind(c(95, 100, 105)),
> + ns = "colorspace")
> R> as(XYZ(100, 100, 100), "LAB")
> L A B
> [1,] 100 8.622384 3.226371
>
> I'll have another look whether this could be exposed easily (cc also
Paul).
>
> Best,
> Z
>
> On Mon, 4 Jun 2018, Glenn Davis wrote:
>
>> In colorspace.R I see:
>>
>> setAs("color", "LAB", function(from)
>> LAB(.Call("as_LAB", from at coords, class(from),
.WhitePoint, PACKAGE = "
>> colorspace"),
>> names = dimnames(from at coords)[[1]]))
>> ...
>> .WhitePoint = NULL
>>
>> and then in colorspace.c and the function CheckWhite(),
>> I see that .WhitePoint = NULL is converted to D65.
>>
>> I would like to pass a different .WhitePoint to
>> as( XYZ( 100,100,100) , "LAB" )
>>
>>
>> I have tried 3 methods:
>> as( XYZ( 100,100,100) , "LAB",
.WhitePoint=XYZ(95,100,105) )
>> .WhitePoint = XYZ(95,100,105)
>> assign( ".WhitePoint", XYZ(95,100,105),
env=as.environment('package:
>> colorspace') )
>> but all fail, for different reasons.
>>
>> How can I transform XYZ to LAB using a whitepoint different than D65 ?
>>
>> Thanks,
>> Glenn Davis
>> gdavis at gluonics.com
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>>
>