-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minimise features imported from image
crate.
#1305
Comments
This sounds like a pragmatic solution to the problem of the |
I just looked through what piet does with the image crate, and it seems it also loads images from a filepath, and it does actually need to decode the images for that. I would personally say that might be out of scope for piet/druid but that's not my decision to make. |
Wait, why did you close this? It seems like a reasonable request. And as far as I can tell, the image loading in piet can still work, it will just only support the formats whose features are included... |
Oh I thought it was dismissed, sorry I misunderstood the response. |
I think the most sensible way to go around this is to default to all default This does mean update druid with new "features" every time image adds support for another format, but that is just kinda how features work, I guess :/ |
Hmm. I personally consider default features to be an anti-pattern (for reasons we're seeing now) and would be entirely comfortable with disabling them, and having people opt in by setting the features on their own Would these features be named "image_jpeg", in analogy to "jpeg_rayon"? |
I think I recently saw some example with a required feature (that way you can just use "druid_shell/jpeg")? How about druid-shell disables by default, and then druid passes on all the features to the user? This gets into messy things, its late here but I will think about it some more. |
I made a little branch here showing what I would do. I could make the feature-chain go al the way to piet, but I don't really see the point in that. (but maybe it should be done to be sure? I dont see the point in having piet load images when druid doesnt depend on it either. Is piet supposed to be used by others too?) |
druid doesn't load images directly, but it uses the |
Maybe I am confused about optional dependencies work in rust, if druid-shell depends no image, and piet has an optional dependency on image, does piet get compiled with But either way, the main question remains, do we do it like this example branch I made or do we make the users import |
Oh, the confusion is probably because the image stuff in druid-shell is only there temporarily while I wait for a piet release that contains piet#321. It seems like that already happened, so I'll make a pr to remove that. Then druid will be actually using the ImageBuf stuff from piet instead of the copy that's (temporarily) in druid-shell. As for the re-exporting features, I don't have a strong opinion either way. |
I personally think the passing through is the "best" way of doing it, but it requires a PR to piet as well. |
Right now using images in druid causes all default features of image to be imported.
This means that I cannot disable features on my end, because druid will "need" them. I am sure druid doesn't need to encode/decode in any image format for me.
The biggest one is "jpeg/rayon" which imports 20 crates or so, which is really not needed for druid.
If this is something you agree with I can minimize the amount of features enabled for image and send in a PR.
The text was updated successfully, but these errors were encountered: