Enum turbojpeg::Colorspace
source · #[repr(u32)]pub enum Colorspace {
RGB = 0,
YCbCr = 1,
Gray = 2,
CMYK = 3,
YCCK = 4,
}
Expand description
JPEG colorspaces.
Variants§
RGB = 0
RGB colorspace.
When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to any of the extended RGB pixel formats or grayscale, but they cannot be decompressed to YUV images.
YCbCr = 1
YCbCr colorspace.
YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) component represents the black & white portion of the original image, and the Cb and Cr (chrominance) components represent the color portion of the original image. Originally, the analog equivalent of this transformation allowed the same signal to drive both black & white and color televisions, but JPEG images use YCbCr primarily because it allows the color data to be optionally subsampled for the purposes of reducing bandwidth or disk space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images.
Gray = 2
Grayscale colorspace.
The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images.
CMYK = 3
CMYK colorspace.
When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can only be decompressed to CMYK pixels.
YCCK = 4
YCCK colorspace.
YCCK (AKA “YCbCrK”) is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and decompressed to CMYK pixels.
Trait Implementations§
source§impl Clone for Colorspace
impl Clone for Colorspace
source§fn clone(&self) -> Colorspace
fn clone(&self) -> Colorspace
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Colorspace
impl Debug for Colorspace
source§impl Hash for Colorspace
impl Hash for Colorspace
source§impl Ord for Colorspace
impl Ord for Colorspace
source§fn cmp(&self, other: &Colorspace) -> Ordering
fn cmp(&self, other: &Colorspace) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for Colorspace
impl PartialEq for Colorspace
source§fn eq(&self, other: &Colorspace) -> bool
fn eq(&self, other: &Colorspace) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Colorspace
impl PartialOrd for Colorspace
source§fn partial_cmp(&self, other: &Colorspace) -> Option<Ordering>
fn partial_cmp(&self, other: &Colorspace) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more