image-rs / image

Encoding and decoding images in Rust
Apache License 2.0
4.87k stars 602 forks source link

Decode to sRGB #1460

Open jrmuizel opened 3 years ago

jrmuizel commented 3 years ago

Many image formats store image data in a color space other than sRGB. It would be nice to be able to be able to request sRGB and have the stored image data converted to sRGB as needed.

I'm interested in implementing this using qcms to do the conversion and was hoping for some pointers on how to expose and plug in this kind of functionality.

fintelia commented 3 years ago

An ImageBuffer derefs into a slice. I think you should just be able to pass that to qcms::Transform::apply(...).

jrmuizel commented 3 years ago

Would the Pixel trait then have some way of obtaining the color space of the source data?

fintelia commented 3 years ago

Unfortunately, no. Some of the individual decoding crates provide a bit more information, but we don't have any common abstraction for that (yet) at the level of this crate. You'd probably have to get that information out of band