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.99k stars 760 forks source link

Darken results in degraded image #706

Open niccih opened 5 years ago

niccih commented 5 years ago

I have a test, on jsFiddle (uses the browser version of 0.5.6), https://jsfiddle.net/niccih/mdftLojv/24/, where I am trying to darken the image. As can be seen the result (second image) is not quite what I was hoping for in that the quality has degraded noticeably.

Any advice as to what I may be missing, or what alternative steps I may take will be greatly appreciated. Note that the 'brightness' example is just for my own reference and is not the result I am looking for. Other image manipulation packages seem fine when darkening the same image, but not being browser based, they are not a viable option (my requirements are dependant on being browser based), hence wanting to use Jimp.

hipstersmoothie commented 5 years ago

It looks like you're using it right. Seems to be a bug in the darken algo we are using

hipstersmoothie commented 5 years ago

You might be able to accomplish this through compositing https://github.com/oliver-moran/jimp/blob/c99d07224a3e043b87561ec87b4426016c7c4abc/packages/jimp/README.md#compositing-and-blend-modes