[Bug] Weird BMP load bug
See original GitHub issueExpected Behavior
The copied bmp
file should be exactly the same as the original one.
Current Behavior
For some reason for this bmp
file content gets moved/shifted. It does not happen for all the bmp
files.
Failure Information (for bugs)
Steps to Reproduce
I’ve created minial reproducible repo:
git git@github.com:elderapo/jimp-bmp-bug.git
cd ./jimp-bmp-bug
yarn
yarn start
Screenshots
Context
- Jimp Version:
^0.8.4
- Operating System:
Ubuntu 14.04
- Node version:
v11.10.0
,v12.10.0
Failure Logs
The loading system for bmp
files seems to be broken. Exact same thing happens when reading bmp
file from disk, buffer. Even when file is saved to a different format it still gets shifted.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Strange error loading texture from .bmp openGL - c++
I think the problem might be bit depth of your bitmap. You should try using this with a 24 bit (bit depth) bmp...
Read more >Weird behavior (losing data) after saving / loading a 8bpp ...
I think it is a bug, since the bmp is loaded corretly and the png are not. I want to save and load...
Read more >bmp image served from router fails to reload despite Cache ...
This made for a weird mismatch between LoadImage, which directly used aLoadFlags, and the methods it called, which used the harmonized load flags...
Read more >A strange Bitmap coloring bug in Animate CC
Hi. Make sure to adjust the image quality in the Publish Settings. Regards,.
Read more >The LoadImage() function doesn't load correctly a 4 bpp ...
Last week I needed to load a bitmap transparently. It contained the icons I wanted to use in a tree control. That's when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a fork of bmp-ts I plan to integrate at some point. If you can find and fix the bug there I’ll merge the changes into jimp
https://github.com/hipstersmoothie/bmp-ts
I’ve been trying to run down an issue with bmp-js (which I believe jimp uses to read bmp files). AFAICT bmp-js does not use the offset value to the actual bitmap data contained in the header info of a bmp file. It just assumes that the bitmap follows on from the header.
I discovered this as I found that bmp files saved from GIMP have extra information in them that bmp files saved from both MSPaint and paint.net don’t put in (see https://stackoverflow.com/questions/30505928/gimp-how-to-export-an-image-to-bmp-without-the-color-space-information-using-a for some information on this extra information )
Anyway - I ended up here and tried your from.bmp file out - and it has extra bytes between the header and the actual bitmap as well and I can replicate your fault in my code.
If I open from.bmp in Win MSPaint.exe and resave it as frompaint.bmp - the extra data is removed and reading the file works perfectly in jimp
I don’t know how to resolve the issue since bmp-js doesn’t seem to be maintained anymore