Support one-bit channels
This commit is contained in:
parent
6e73a1780b
commit
185cf61d1f
1 changed files with 2 additions and 1 deletions
|
|
@ -544,6 +544,7 @@ impl<W: Write> PngEncoder<W> {
|
|||
color: ExtendedColorType,
|
||||
) -> ImageResult<()> {
|
||||
let (ct, bits) = match color {
|
||||
ExtendedColorType::L1 => (png::ColorType::Grayscale, png::BitDepth::One),
|
||||
ExtendedColorType::L8 => (png::ColorType::Grayscale, png::BitDepth::Eight),
|
||||
ExtendedColorType::L16 => (png::ColorType::Grayscale, png::BitDepth::Sixteen),
|
||||
ExtendedColorType::La8 => (png::ColorType::GrayscaleAlpha, png::BitDepth::Eight),
|
||||
|
|
@ -623,7 +624,7 @@ impl<W: Write> ImageEncoder for PngEncoder<W> {
|
|||
// contract of `write_image`.
|
||||
// TODO: assumes equal channel bit depth.
|
||||
match color_type {
|
||||
L8 | La8 | Rgb8 | Rgba8 => {
|
||||
L1 | L8 | La8 | Rgb8 | Rgba8 => {
|
||||
// No reodering necessary for u8
|
||||
self.encode_inner(buf, width, height, color_type)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue