Repository navigation
Add basic image integration - #109
RunDevelopment wants to merge 7 commits into
Conversation
I'd generally recommend depending on only a single major version of a dependency. We generally aim to only release new major versions
Panicking seems fine to me.
I'd suggest making a struct with no fields (say Though one other comment on |
|
Thank you for your input!
I initially wanted to depend on 0.25.x, but the MSRV of 0.25.0 is higher than the MSRV of this crate. So enabling the Honestly, I think this might be a good reason to raise the MSRV of this crate. It solves the dependency problem, and I wanted to use features from newer compiler versions anyway.
I agree with that, especially the discoverability. I'll just make them functions on the view types. |
|
I'd suggest just raising the MSRV. Though where did you see that the MSRV of image 0.25.0 was newer than this crate's? It had an MSRV of 1.67.1. |
It was until I raised the MSRV of this crate to 1.73.0 two days ago :). The MSRV was 1.63.0 before that. I made raising the MSRV its own PR, because I knew that I would make lots of changes (mostly |
I added basic integration with the
imagecrate. This means:ImageView::from(&ImageBuffer)andImageView::try_from(&DynamicImage)(same forImageViewMut).TryFromconversions forimage::ColorTypeanddds::ColorFormatin both directions.Since all APIs that need pixel data in this crate use
ImageView{,Mut}, this should make it relatively straightforward to useimagetypes now. E.g. here's an example for encoding from the docs:Open questions/TODO:
What versions ofimageshould this crate depend on? I'm currently using>=0.24, <1.0, but I'm not sure whether that's a good idea. Some guidance would be nice here.It uses
0.25now after raising the MSRV of this crate.All image to view conversion currently panic if theImageBufferhas less data than expected. I.e. it's possible createImageBuffers where the backing container has less thanw*h*color.bytes_per_pixel()bytes.imageseems to generally panic when such an image is used, but the docs don't directly say that such images are invalid.So do you think panicking inside<ImageView as From>::fromis okay for such images, or should I move to usingTryFromto handle this case without panicking?The panics are okay.
<ImageView as TryFrom<&DynamicImage>>::Erroris currently(). This error is returned when theDynamicImagehas aColorTypethat isn't supported by this crate. I'm not sure what error type to return here. Is()fine?They now use
pub struct UnsupportedColorType;.Could you please help me with this, @fintelia?
Related to image-rs/image-extras#16