question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Weird BMP load bug

See original GitHub issue

Expected 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 from.bmp to.bmp

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:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
hipstersmoothiecommented, Oct 15, 2019

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

1reaction
cymplecycommented, Oct 15, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found