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

Does this supports RGB buffer for input? #4

Open
wx257osn2 opened this issue Jun 8, 2022 · 2 comments
Open

Does this supports RGB buffer for input? #4

wx257osn2 opened this issue Jun 8, 2022 · 2 comments

Comments

@wx257osn2
Copy link

I'm newbie for zig so it may my misunderstanding, but it seems that this encoder implementation interprets the input buffer as RGBA packed pixel images regardless Header.format . If it's true, this implementation can't accept 3-channel images.

Does this supports RGB buffer for input?

@ikskuh
Copy link
Owner

ikskuh commented Jun 8, 2022

This implementation operates not on a byte array, but always on a Color array which is an RGBA value. But if you serialize an image with all alpha bytes as fully opaque, it is serialized as RGB.

Note that this doen't matter at all, as QOI only can encode RGBA images anyways, the file header value is purely informational

@wx257osn2
Copy link
Author

wx257osn2 commented Jun 8, 2022

This implementation operates not on a byte array, but always on a Color array which is an RGBA value.

OK, so we need to convert a 3-channel packed pixel byte array to a Color array by adding fully opaque alpha channels before encoding, right?

as QOI only can encode RGBA images anyways, the file header value is purely informational

Your point also make sense; the reference implementation always handles 4-channel pixels, but just doesn't touch the alpha when channels == 3.
However, at least the reference can encode the byte array which contains a 3-channel packed pixel image directly according to the channels.
IMO that is an overstatement from this point of view.

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

No branches or pull requests

2 participants