Color Space Converter

Author: Duane Schwartzwald (vonschwartzwalder at
History: 2006/02/15: First version
2006/02/22: Title of the window changes to reflect the color space; uses title to suggest default color space conversion
2006/03/12: Option to convert to separate float images; white point can be specified
2007/03/01: Harry Parker fixed a bug in the RGB to XYZ and XYZ to RGB converters
2012/11/05: Fixed a bug that caused an exception if no image was open
Installation: Save Color_Space_Converter.jar in the plugins folder or subfolder, restart ImageJ and there will be a new Color Space Converter command in the Plugins menu or submenu.
Description: This plugin converts between any combination of RGB, HSB, LAB and XYZ, possibly modifying the image in place. More color spaces can be added later, perhaps, if needed.

The HSB conversions use the java Color class. All others rely on code that converts to XYZ and then on to something else.

The RGB to XYZ conversion assumes sRGB as input (with it's D65 white point). Pretty standard, should give decent results in most cases.

The RGB to L*a*b* conversion assumes sRGB for conversion to XYZ but then uses the specified white point to convert from XYZ to L*a*b*.

All in-place output is scaled and placed in the RGB image. HSB is normally 0..1, L*a*b* is normally 0..100, -100..100, -100..100 and XYZ is normally 0..100, 0..100, 0..100. That means that the resulting images are NOT what you get with pure conversions (like Photoshop). It does give you something interesting to look at. There is a danger of having out-of-gamut and round off errors creep in (actually, run screaming in) and this becomes readily apparent after multiple conversions.

All separated images are unscaled and placed in FloatProcessors.

I don't make any claim as to accuracy: use at your own risk.

|Plugins | Home |