Donations requested

I love China. I will live there someday. Help me get there sooner by donating to my Move to China fund. Thank you!

Sunday, July 25, 2010

Perl PDL lut_data in a wpic

And now for something completely different...

It took me days to figure this out. Being completely new to the Perl Data Language (PDL) package, I was in uncharted territory.  I looked for solutions to this all over the intertubes, but found none.

Just in case anyone else is stupefied by this problem, here is the code solution:

($i,$r,$g,$b) = lut_data('bgyrw');
$lut = byte transpose(pdl($r,$g,$b) * 255);
# build your $a image here...
$a->wpic("image.pbm", {LUT => $lut});