Is there a general desire for this subclass of Transform? I’m coding it up for some other projects. It is intended to be, for color representations, sort of what PDL::Transform::Cartography is to map projections.
At the moment it’s living in my localpdl github tree, but I’d be happy to either spin it out as a CPAN module or merge it into the PDL::Transform part of the distribution, if there’s general interest. The module handles conversions from normalized RGB (floating point on [0,1]) to/from CMYK, HSV, HSL, and HSI. It also handles bRGB, and bCMYK (floating point or byte values on [0,255) ). More color representations are planned. Gamma correction is fully supported. The idea is that you can, e.g., say things like: # simple CMYK conversion $im = rpic(‘mypic.png’); # read bytes $im_cmyk = $im->apply( t_cmyk x !t_brgb ); # convert to normalized, then normalized CMYK # Fancy CMYK conversion with different gamma representations for screen and ink; byte output $im_cmyk_fancy = $im->apply( t_cmyk( b=>1, gamma=>2, htgamma=>0.7 ) x !t_brgb; # improve saturation in an image without affecting brightness $im = rpic(‘mypic.png’)->apply( !t_brgb ); # read and convert to nRGB $im_hsv = $im->apply( t_hsv ); # convert to hue/sat/brightness $im_hsv->((1)) *= 1.5; # increase saturation $im2 = $im_hsv->apply( t_brgb x !t_hsv ); # convert back to byte RGB If there’s interest, I’m willing to push it out — but if not I’ll probably sit on it for a while. Cheers, Craig ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ pdl-devel mailing list pdl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-devel