diff --git a/src/encoder/colortype.rs b/src/encoder/colortype.rs index 4055fdf..2f97066 100644 --- a/src/encoder/colortype.rs +++ b/src/encoder/colortype.rs @@ -100,3 +100,24 @@ impl ColorType for CMYK8 { const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK; const BITS_PER_SAMPLE: &'static [u16] = &[8, 8, 8, 8]; } + +pub struct CMYK16; +impl ColorType for CMYK16 { + type Inner = u16; + const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK; + const BITS_PER_SAMPLE: &'static [u16] = &[16, 16, 16, 16]; +} + +pub struct CMYK32; +impl ColorType for CMYK32 { + type Inner = u32; + const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK; + const BITS_PER_SAMPLE: &'static [u16] = &[32, 32, 32, 32]; +} + +pub struct CMYK64; +impl ColorType for CMYK64 { + type Inner = u64; + const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK; + const BITS_PER_SAMPLE: &'static [u16] = &[64, 64, 64, 64]; +} diff --git a/tests/encode_images.rs b/tests/encode_images.rs index c40fac3..9d1ecfd 100644 --- a/tests/encode_images.rs +++ b/tests/encode_images.rs @@ -105,6 +105,11 @@ fn test_rgb_u8_roundtrip() { test_u8_roundtrip::("rgb-3c-8b.tiff", ColorType::RGB(8)); } +#[test] +fn test_cmyk_u8_roundtrip() { + test_u8_roundtrip::("cmyk-3c-8b.tiff", ColorType::CMYK(8)); +} + #[test] fn test_gray_u16_roundtrip() { test_u16_roundtrip::("minisblack-1c-16b.tiff", ColorType::Gray(16)); @@ -115,6 +120,11 @@ fn test_rgb_u16_roundtrip() { test_u16_roundtrip::("rgb-3c-16b.tiff", ColorType::RGB(16)); } +#[test] +fn test_cmyk_u16_roundtrip() { + test_u16_roundtrip::("cmyk-3c-16b.tiff", ColorType::CMYK(16)); +} + #[test] fn test_gray_u32_roundtrip() { test_u32_roundtrip::("gradient-1c-32b.tiff", ColorType::Gray(32));