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

Added support for BMP files #60

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

Conversation

ExtReMLapin
Copy link
Contributor

No description provided.

@ExtReMLapin
Copy link
Contributor Author

tested with 24bits bmp and 1bit bmp

@marcoffee
Copy link
Contributor

@ExtReMLapin could you add support for BMPs with negative height?

You just have to change the unpack format specification to "<Ll" (or maybe "<ll" if you also want to supported signed width, but I don't know if width < 0 is allowed) and add height = abs(height), then it will work fine.

Here is an example (I had to zip it, because GitHub do not support .bmp images)
negative-height.zip

Here is the same image, but converted to .png
negative-height

In this example (if correctly parsed), it must consist of a 100 x 300 image where the top is a red square, the middle is a green square, and the bottom is a blue square. On the BMP header, the height is specified as -300, i.e., the struct.unpack call as-is would return (100, 4294966996).

@ExtReMLapin
Copy link
Contributor Author

🤠 Done !

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.

None yet

2 participants