Jimp: Decoding BMP file created using GIMP

Created on 22 Sep 2018  路  3Comments  路  Source: oliver-moran/jimp

Expected Behavior

I have a program that copies each pixel onto another picture with the same size:
The expected behavior is that the input.bmp should be cloned and saved as output.bmp

Current Behavior

The output image is not exactly the input file.

Failure Information (for bugs)

Steps to Reproduce

const Jimp = require('jimp');

async function program() {
    const input = await Jimp.read('input.bmp');
    const output = await Jimp.create(input.getWidth(), input.getHeight());

    for (let y = 0; y < input.getHeight(); y++) {
        for (let x = 0; x < input.getWidth(); x++) {
            output.setPixelColor(input.getPixelColor(x, y), x, y);
        }
    }

    await output.writeAsync('output.bmp');
}

program();

Screenshots

For some reasons, GitHub doesn't allow to upload BMP files. Here's the link to both files:

https://files.fm/u/g6htyvg4

Context

  • Jimp Version: v0.5.0
  • Operating System: Linux Ubuntu 18.04.1
  • Node version: v8.11.2
bug

Most helpful comment

The issue arises when an image is exported as BMP using GIMP and color space information is written to it.

To avoid this issue, select "Do not write color space information" under "Compatibility Options" when exporting as BMP.

All 3 comments

I just tried clone() function and it resulted with the same issue:

const Jimp = require('jimp');

async function program() {
    const input = await Jimp.read('input.bmp');
    const output = input.clone();

    await output.writeAsync('output.bmp');
}

program();

An update.
The issue seems to be in decoding BMP files created using GIMP.
I face no issues if the input BMP was created using JIMP library.

The issue arises when an image is exported as BMP using GIMP and color space information is written to it.

To avoid this issue, select "Do not write color space information" under "Compatibility Options" when exporting as BMP.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chancein007 picture chancein007  路  5Comments

molipha picture molipha  路  6Comments

sesirimarco picture sesirimarco  路  3Comments

PainKKKiller picture PainKKKiller  路  5Comments

Yimiprod picture Yimiprod  路  5Comments