-
Notifications
You must be signed in to change notification settings - Fork 674
Image reader #1014
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
Image reader #1014
Conversation
It seems easy enough to just dynamically create a |
20d2d4a to
27f31bf
Compare
Does not touch the public interface, only internal `_impl` variants which are simply referenced from their new location.
Firstly, simply renames load to decode. Also splits open into to operations: - open, which will inspect the file contents to guess the correct format *before* falling back to a path. - from_path, which imitates the old behaviour.
Don't deprecate them just yet, for now they are even the underlying primitives instead of being wrappers around the reader.
Fixes guess_format to only change the format on successful guesses.
Minimize the commitment of public interface for now. The builder style methods are likely the most immediately useful.
|
Got a weird failure, seems spurious and within the |
|
No, it's not spurious. But I'm not sure what to make of it: |
|
Going to ignore it: rust-lang/cargo#7429 |
|
I'm glad to finally have this landed. Thanks @fintelia for the review discussions. |
Replace free reader functions with
Readerstructure as sketched in this comment of #1007. This provides an api for reading image metadata and pixels without coupling to format guessing instead of adding all possible combinations of methods.Also makes the interface for directly turning an
ImageDecoderinto aDynamicImagepublic.Closes: #1007
Closes: #716
Closes: #577
Unresolved questions:
Should opening a file automatically try to guess the format from the first bytes? Or only from the path? From neither?Offer two methods.Offer a method and a builder style continuation.Should the path be contained in the data stored in theReader? This would allow other methods to emulate having opened a file, without going through the actualfsapi.ImageFormat::from_pathcan be used.Should there be a specialLater, if the need arises.loadfor formats which do not requireSeek?What about formats not requiringEasy to wrap inBufReadbut onlyRead?BufReader.