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

Incorrect handling of RGB565 images during conversion to BMP or RGB888 #676

Open
jksemple opened this issue Aug 20, 2024 · 0 comments
Open

Comments

@jksemple
Copy link

There is an inconsistency in the handling of RGB565 images in memory. When decoding a JPG the 16-bit RGB565 pixel value is composed (conversions/to_bmp.c lines 150-155) with R G B bits in that order in the word and then written to memory as low-byte high-byte. This little-endian order is consistent with the ordering of bytes for other 16-bit or 32-bit values in a BMP e.g. image length.

However, when converting to BMP or RGB888 format the RGB565 pixel value is read as if it were stored as high byte followed by low byte (conversions/to_bmp.c lines 360 and 361 and lines 254 255). This has a psychedelic effect on the colours in resulting images.
A workaround is to swap the order of bytes in an RGB565 image before such a conversion but this is not an acceptable fix.

Please swap lines 360/361 and lines 254/255

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

1 participant