Crates.io | image-decompose |
lib.rs | image-decompose |
version | 0.4.1 |
source | src |
created_at | 2021-05-13 00:34:55.562405 |
updated_at | 2021-05-21 17:52:57.066161 |
description | Decomposes image into separate channels in different colour spaces |
homepage | |
repository | https://github.com/mina86/image-decompose |
max_upload_size | |
id | 396754 |
size | 1,103,714 |
The tool decomposes an RGB image into it’s channels in different colour spaces. sRGB (including linear RGB), HSL, HSV, HBW, XYZ, xyY, L*a*b*, LChab, L*u*v*, LCHuv, CMY and CMYK models are supported.
For each of those the program will load input image as an sRGB image, convert it to given colour space and then create an image which includes coordinates
An example image is included in data
directory which can be used to
test the program:
cargo run -- -y --resize 300x400 --crop 150x300+75+50 \
-o out data/umbrella-sky.jpg
As a result, the tool generates handful of WebP images and saves them
in the out
directory with names matching umbrella-sky-*.webp
pattern. Each of the image includes decomposition of the source image
into separate channels in given colour space.
For example:
Perhaps the most familiar decomposition showing how much red, green and blue is in each pixel of the image. RGB model is additive thus the result comes from adding all those colours.
HSL attempts to be more user friendly by introducing more natural hue, saturation and lightness controls. The model isn’t perceptually uniform though so changing only hue affects luminosity of the colour.
Black spots in the hue channel indicates grey colours (which includes white and black) in the source images for which hue is undefined.
L*u*v* colour space tries to be perceptually uniform. The decomposition demonstrates the L* channel corresponds to luminosity while u* and v* coordinates fall on the green-red and blue-yellow axes.
The L*C*h model makes the model easier to interpret by representing chromaticity with more familiar hue and chroma values.
CMY and CMYK colour models are subtractive. This is demonstrated by the channels being ‘inverses’ of the image. The less red the image has, the more cyan is used and the same for green-magenta and blue-yellow pairs. The inverse is especially apparent with black (or key) channel in CMYK model.