Skip to content
Discussion options

You must be logged in to vote

@DrkWzrd if you expect various pixel types to appear in your input, you can utilize Image.Identify to detect the pixel format before using it.

Here is an example created by Claude Code. I tested it only on a tiny minority of the cases, so do not assume the code is correct, adapt it to your use-case and test it out extensively!

I think the library could help here more either by providing an API to enforce the original format or by making sure decoders are doing better job picking the right format (thought this could be insufficient if users need a guarantee, given the basic Image.Load overload is not designed to provide it).

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@DrkWzrd
Comment options

@JimBobSquarePants
Comment options

@antonfirsov
Comment options

Answer selected by DrkWzrd
@DrkWzrd
Comment options

@JimBobSquarePants
Comment options

@DrkWzrd
Comment options

@antonfirsov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants