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

bugfix: Add support for negative heights #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shareefj
Copy link

@shareefj shareefj commented May 2, 2023

BMP files with a negative height imply that the origin is top left so we need to swap all rows.

@shareefj
Copy link
Author

shareefj commented May 2, 2023

Hi, I saw that you had forked this library and improved it so I thought this might be a better place than Sourceforge for other bug fixes.

I've been trying to find a library that copes with negative heights but failed so here is an attempt at fixing it. I'm not sure if it's worth also handling negative widths too? I don't know how common a right hand origin would be.

Missing braces caused color table to be overwritten every time a BMP was
written to file.
An exception was raised if, for < 16-bit depths, the color table was
not fully specified.  This isn't illegal and the following code seems to
pad the unspecified entries with white anyway.
BMP files with a negative height imply that the origin is top left so we
need to swap all rows.
@shareefj shareefj force-pushed the bugfix/support_negative_heights branch from d324952 to bf2f34f Compare September 21, 2023 12:00
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

Successfully merging this pull request may close these issues.

1 participant