-
Notifications
You must be signed in to change notification settings - Fork 618
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
Add PCX decoder support #2364
Add PCX decoder support #2364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some initial self-review.
4647c86
to
95c49f5
Compare
I wrote up some thoughts on format support in #2367. High level, I don't think we should add PCX, but do want to think about making it easier for users to deal with formats not directly supported by this crate. |
@fintelia just so I know, does that decide the fate of this PR or is it still up in the air? I just want bevy to load my files; if FWIW, I was planning on adding A tidy alternative would be a way to register codecs at build time (runtime probably isn't necessary), as go's |
Yes. If @HeroicKatora feels differently we can discuss further, but otherwise we can go ahead and close this PR. I'll add that from skimming the code quality does look quite good, and I've also just opened #2369 to encourage having discussions prior to doing all the implementation effort. (As a side note, supporting all image formats is impossible because there's no official list: anybody can invent their own format and people do so pretty often.) |
I think it would be good to implement |
First of all, I do agree with code quality :+1. Following the thoughts raised out in #2367, and in particular I like the tiered view #2363 (comment) , I think we should support this format in some capacity. And in particular, by having the trait implemented but not dispatching onto the file without explicit opt-in (as written in the linked comment, I'd liken it to tier 3). I tend to agree that some It would be most beneficial to users, that's the crucial part. My argument would be it doesn't matter so much to me if a format itself is fringe, as rather if So 👍 me with the licensing comment resolved. |
Just to double check, what is the source of the test images and what license are they under? |
@fintelia they're from the pcx crate - #2364 (comment) -> https://github.com/kryptan/pcx/tree/master/test-data . They didn't originate there though. https://github.com/drewnoakes/metadata-extractor-images/tree/main/pcx has them, for instance. https://netghost.narod.ru/gff/sample/images/pcx/index.htm has a 1996 imprint and has marbles.pcx and gmarbles.pcx 🤔 |
Yeah, "Copyright © 1996 O'Reilly & Associates, Inc. All Rights Reserved." isn't exactly a suitable license statement... If that's the original source of those images they need to be replaced |
That's fair. I wrongly assumed that since they were in a WTFPL crate, it'd be fine to reuse them! I'll put together a PR that replaces them. I tracked down the CGA PCX files to https://samples.ffmpeg.org/image-samples/pcx/cga/cga-pcx.txt - they also appear in the MPlayer samples directory. No explicit copyright grant in that file; ffmpeg itself is lgpl, mplayer gpl. I'll just yoink those out as well. All the obscure parts of the format are still tested in the pcx crate; I think we just need a single image that allows us to verify that we're up to that crate correctly. Oh, I also found a "proper" use of PCX in the wild - according to https://convertimage.net/convert-a-picture/to-pcx/ :
A brief look tells me this was true in 2007, at least. |
This PR adds support for decoding PCX images. This is a raster format introduced in 1985. Further details on Wikipedia: https://en.wikipedia.org/wiki/PCX; it saw fairly extensive use up to the end of the 20th century, but is definitely obsolete now. However, there is still extant data using the format.
My hobby project is a game engine recreation that happens to need to load a range of assets in the PCX format; using the image crate through bevy to (attempt to) load PCX files is how I ended up writing this PR.
Since it's an obsolete format, I've opted to only implement the decoder side, but the pcx crate does have an encoder as well if we wanted to wire that up. Perhaps "historic format" sounds better!
I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to choose either at their option.