Skip to content

Decoding TIFF images as 1 bit black/white images with Fax4 compression #1822

@pratik-mahamuni

Description

@pratik-mahamuni

Thank you for creating this library and reading my question.

I am obtaining byte data of images from an external API using the reqwest library. Specifically, I am getting the byte data using the .bytes() method.

I then try to use those bytes to save the image or convert the image into a different format (TIFF to PNG) and I get the following error:
Unsupported(UnsupportedError { format: Exact(Tiff), kind: Color(Unknown(1)) })'.

I am using the following code to parse the bytes and obtain the decoded image:

let mut reader = image::io::Reader::with_format(std::io::Cursor::new(response), image::ImageFormat::Tiff);
let img = reader.decode().expect("Could not decode image");

Portion of the byte data received for a particular image:
image

How do I add the ColorFormat information to bytes data once I have received them? Or is there an alternative way I can still decode the image without the ColorFormat?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: formatsTowards better encoding format coverage

    Type

    No type

    Projects

    Status

    Gif

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions