-colorspace LCHab
Posted: 2014-01-18T22:59:00-07:00
The C channel of LCHab is improperly scaled in memory, and so clips. The clipping is bad enough that even the sRGB colorspace does not quite fit in the current implementation of LCHab. It easily could be made to include all of Lab. I believe the valid channel ranges are:
L 0 - 100 (same value as in Lab)
C 0 - 182 (to cover Lab)
H 0 - 360°
The C channel appears to be implemented as +/-128 (the same as a & b). This not only causes clipping, but also unnecessary compression into 7 bits.
; Minimal rounding error is introduced in the sRGB > Lab > sRGB round trip.
> convert -size 1x1 xc:#00F -colorspace Lab -colorspace sRGB txt:-
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (0%,0.00610361%,100%) #00000004FFFF srgb(0%,0.00610361%,100%)
; Clipping occurs in the sRGB > LCHab > sRGB round trip.
> convert -size 1x1 xc:#00F -colorspace LCHab -colorspace sRGB txt:-
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (12.52%,4.68757%,96.463%) #200D0C00F6F1 srgb(12.52%,4.68757%,96.463%)
; Here the clipping in the middle C channel can be seen.
> convert -size 1x1 xc:#00F -colorspace LCHab txt:-
# ImageMagick pixel enumeration: 1,1,65535,lchab
0,0: (32.3033%,100%,85.0797%) #52B2FFFFD9CD lchab(32.3033%,100%,85.0797%)
ImageMagick 6.8.8-1 Q16 x64 2013-12-25 on Windows 7
L 0 - 100 (same value as in Lab)
C 0 - 182 (to cover Lab)
H 0 - 360°
The C channel appears to be implemented as +/-128 (the same as a & b). This not only causes clipping, but also unnecessary compression into 7 bits.
; Minimal rounding error is introduced in the sRGB > Lab > sRGB round trip.
> convert -size 1x1 xc:#00F -colorspace Lab -colorspace sRGB txt:-
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (0%,0.00610361%,100%) #00000004FFFF srgb(0%,0.00610361%,100%)
; Clipping occurs in the sRGB > LCHab > sRGB round trip.
> convert -size 1x1 xc:#00F -colorspace LCHab -colorspace sRGB txt:-
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (12.52%,4.68757%,96.463%) #200D0C00F6F1 srgb(12.52%,4.68757%,96.463%)
; Here the clipping in the middle C channel can be seen.
> convert -size 1x1 xc:#00F -colorspace LCHab txt:-
# ImageMagick pixel enumeration: 1,1,65535,lchab
0,0: (32.3033%,100%,85.0797%) #52B2FFFFD9CD lchab(32.3033%,100%,85.0797%)
ImageMagick 6.8.8-1 Q16 x64 2013-12-25 on Windows 7