Skip to content

Add has_format method to ImageReaderOptions - #3136

Open
dylanheller wants to merge 1 commit into
image-rs:mainfrom
dylanheller:has-format
Open

dylanheller wants to merge 1 commit into
image-rs:mainfrom
dylanheller:has-format

Conversation

@dylanheller

Copy link
Copy Markdown

We can't check if ImageReaderOptions::with_guessed_format successfully set a custom format that can't be represented as ImageFormat. ImageReaderOptions::format returns None for JXL or HEIC even though a format is set.

We could use ImageReaderOptions::into_decoder and check whether the result is Err(ImageError::Unsupported). But if the format is set, this method performs extra initialization work.

Adding has_format would help to quickly check whether a file is a supported image or not, until there is a unified image format type.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant