Colorspace Conversion Tools

버전 2.3.2 (5.81 MB) 작성자: DGM
Bidrectional image conversion for HSI, HSL, HWB, HSY, HuSL, LCH, and others

다운로드 수: 1.2K

업데이트 날짜: 2022/9/30

GitHub에서 호스트

GitHub에서 라이선스 보기

This package includes bidirectional tools for converting between sRGB and the following color models:
HSY (chroma-normalized polar YPbPr)
HuSL (chroma-normalized LCHab and LCHuv)
HSYp (rotationally-symmetric subset of HSY)
HuSLp (rotationally-symmetric subset of HuSL)
LCH (polar variants of LAB, LUV, OKLAB, and SRLAB)
Various luma-chroma models (YPbPr, YCbCr, YUV, YIQ, YDbDr, YCoCg)
CMYK (a naive transformation for the purpose of changing from additive to subtractive workflow -- not a profiled method for print)
Also included is maxchroma(), a tool used for finding the maximum chroma of the sRGB gamut given L & H coordinates in any of the supported spaces (LCHab, LCHuv, SRLAB2 LCH, as well as polar YPbPr and biconic subsets of these spaces)
▒▒ HSI and HSL:
These really need no introduction. The included tools are basic and provide conventional functionality.
▒▒ HuSL and HSY:
HuSL and HSY are merely conceptually similar adaptations of different families of color models. "Human-Friendly HSL" (HuSL) is a chroma-normalized variant of CIELCH designed to keep operations within the sRGB gamut. This is convenient for intuitive selection of colors, or for color adjustment with the intention of returning to RGB space. While the original HuSL developer has changed the model name from HuSL to HSLuv, these tools still use the original naming conventions.
As L and H are varied in LCH, the maximum allowable chroma changes dramatically and nonintuitively. Increasing L or rotating H for a highly saturated color will often move the color point outside the RGB gamut and cause undesired results.
While HuSL has convenience or particular advantages over LCH, it's slower and has a highly distorted chroma space. This makes it less useful for direct color comparison or specification. HuSLp variants are normalized and bounded to the maximal biconic subset of the projected RGB space. This means HuSLp avoids distortion of the chroma space when normalizing, preserving the uniformity of the parent space. Unfortunately, this also means it can only render colors near the neutral axis (pastels). HuSLp is mostly useful for relative specification of uniform colors.
The original HuSL implementations are all based on CIELCHuv. This version offers the option to use either CIELCHab or CIELCHuv. By default, lookup tables are used for speed, though a direct calculation method can be optionally specified.
▒▒ LCH tools:
The core functions RGB2LCH and LCH2RGB have several optional modes not found in other conversion tools. These include the following ...
The ability to control data truncation behavior: LCH data may be truncated before or after converting to RGB. Conventional conversion tools truncate after conversion, resulting in out-of-gamut points being compressed toward the saturated corners of the RGB cube. Truncation before conversion minimizes apparent image alteration, and may be achieved via a LUT for speed, or via direct calculation if desired. The user may also opt to not truncate data at all (default).
For the purpose of testing in-gamut state, the gamma-correction routine can be optionally disabled. This speeds calculations when finding the gamut boundaries.
Support for 65k white point (standard for sRGB), and a Bradford-adapted conversion for a 50k white point is also available.
Information on SRLAB2 can be found at
Information on OKLAB can be found at
The direct LUV method for HuSL is a fairly simple adaptation of the C and Lua implementations by Alexei Boronine et al:
These files are part of my Matlab Image Manipulation Toolbox:

인용 양식

DGM (2022). Colorspace Conversion Tools (, GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.