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
13.97k stars 762 forks source link

Larger (bytes) processed file than original #807

Open Paul-Browne opened 4 years ago

Paul-Browne commented 4 years ago

Expected Behavior

I expect the processed file size to be less than the original

Current Behavior

The processed file size is greater than the original

Failure Information (for bugs)

Even with .quality(75) and in some cases a smaller size then the original, the processed file is larger in bytes

jimp.read("src/path/to/image.jpg", (err, file) => {
    if (err) {
        console.log(err);
    } else {
        file.resize(400, jimp.AUTO)
            .quality(75)
            .write("public/path/to/image.jpg");
    }
});
AllenZhang34 commented 4 years ago

@hipstersmoothie I also have this problem. I keep the size same with the original. Only lower the quality. But the size is bigger then Original. code:

var Jimp = require('jimp');

// open a file called "lenna.png"
Jimp.read('test1.jpg', (err, test) => {
  if (err) throw err;
  test
    .resize(944, 320) // resize
    .quality(70) // set JPEG quality
    .write('test1-small.jpg'); // save
});

image

Could you please help why does it happen? Thanks a lot!