Skip to content
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

QOI format support #699

Open
jxtps opened this issue Sep 22, 2022 · 2 comments
Open

QOI format support #699

jxtps opened this issue Sep 22, 2022 · 2 comments

Comments

@jxtps
Copy link

jxtps commented Sep 22, 2022

The QOI image format ( https://qoiformat.org/ ) offers similar compression performance to PNG, but with greatly reduced CPU load for both encoding & decoding. This makes it an excellent format for internal CPU bound image processing where lossless serialization is necessary.

There are at least three java implementations:

  1. https://github.com/MarkJeronimus/qoi-java-spi
    1. Looks promising!?
  2. https://github.com/saharNooby/qoi-java
    1. Issues: It doesn't work with Play Framework's reload feature (qoi-java-awt plugin goes missing), and it doesn't read meta-data efficiently (it just reads the whole image)
  3. https://github.com/pfusik/qoi-ci
    1. Issues: it just provides raw arrays, no BufferedImage

Maybe one of them could be incorporated into TwelveMonkeys? Thanks!

@jxtps
Copy link
Author

jxtps commented Sep 22, 2022

Personal pet peeve: MarkJeronimus' implementation selects BufferedImage.TYPE_3/4BYTE_BGR over BufferedImage.TYPE_INT_A/RGB, whereas I much prefer the latter.

I know it's possible to force the format used when reading (as you so graciously answered about in https://stackoverflow.com/questions/71212279/is-there-a-way-to-get-java-to-read-a-png-as-type-int-rgb-type-int-argb but that reduces performance for JPEG and PNG, so it requires more clever logic.

@haraldk
Copy link
Owner

haraldk commented Sep 22, 2022

Hi @jxtps,

While certainly doable, it's not necessarily a goal to support as many formats as possible in the library. Any new plugin comes with a cost (for the maintainers, which is.. me). And this format doen't really seem very widespread... If there are other good Java implementations (even ImageIO support), maybe it's better to help out there, to make it support the stuff you like. Have you been in contact with the author? But yes, https://github.com/MarkJeronimus/qoi-java-spi looks promising! 😉

Personally, I would also select TYPE_3BYTE_BGR over TYPE_INT_RGB for most formats, just because it saves 25% memory. And allow the client to select something else if desired, with reasonable performance.

The qoi-java-awt reload issue sounds like a variation on the issues of deploying ImageIO plugins in a web app, but I'm not familiar with the Play Framework so I may be wrong.

Anyway, thanks for bringing this up! I'll think about it... 😎

--
Harald K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants