jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
14.04k stars 760 forks source link

Convert BMP to JPG and resulted image has incorrect color #975

Open railsstudent opened 3 years ago

railsstudent commented 3 years ago

Expected Behavior

The converted JPG image should maintain the same color scheme.

Current Behavior

The colors of the converted JPG image fall in the red spectrum

Failure Information (for bugs)

Screenshots

Original image original-image

Outputted image lena-small-bw4-1609828096077

Steps to Reproduce

Failure Logs

railsstudent commented 3 years ago
  1. Write a small node program to convert a bmp image to JPG const filename = 'siblings.bmp' var Jimp = require('jimp');

Jimp.read(filename, (err, lenna) => { if (err) throw err; lenna .write(lena-small-bw4-${Date.now()}.jpg); // save });

  1. Execute the node program: node bmp-jpg.js
  2. Open the JPG image and the colors of the image are converted to red unexpectedly
Mitolius commented 1 year ago

I have the same problem converting bitmap to png. It works with 24bits bitmap but I have incorrect color result for 1, 4, 8, 16 (unsupported), 32 bits bitmap. Help appreciate.