jimp icon indicating copy to clipboard operation
jimp copied to clipboard

brighten differs from pre v1

Open Steve-Mcl opened this issue 1 year ago • 3 comments

Has the parameter value definition changed from Jimp 0.x to 1.x?

Expected Behavior

Brightness with a value of 0 should not affect image like it did in v0.x Brightness with a value of 1 should fully lighten an image like it did in v0.x Brightness with a value of -1 should fully darken an image like it did in v0.x Brightness with a value of -0.5 should half darken an image like it did in v0.x Brightness with a value of 0.5 should half lighten an image like it did in v0.x

Using Jimp V0.x (using Node-RED to simplify testing) image

Current Behavior

Brightness with a value of 0 in v1.6 behaves differently - it darkens the image Brightness with a value of 1 in v1.6 behaves differently - it has little affect on the image Brightness with a value of -1 correctly fully darkens an image like it did in v0.x Brightness with a value of -0.5 in v1.6 behaves differently - it FULLY darkens the image Brightness with a value of 0.5 in v1.6 behaves differently - it half darkens the image

image

Failure Information (for bugs)

Steps to Reproduce

Demonstrating -0.5 brightness

  1. load image
    1. image
  2. invert
    1. image2
  3. apply brightness -0.5
    1. image3

Demonstrating -0.0 brightness

  1. load image
    1. image
  2. invert
    1. image2
  3. apply brightness -0.0
    1. image3

Demonstrating 1.0 brightness

  1. load image
    1. image
  2. invert
    1. image2
  3. apply brightness 1.0
    1. image3

Context

  • Jimp Version: 1.6.0
  • Operating System: Win 11
  • Node version: 18

Failure Logs

Steve-Mcl avatar Dec 31 '24 13:12 Steve-Mcl

Can anyone at least acknowledge there was a conscious decision to change how brightness function works or if it is a bug?

If it is a confirmed change, I can work around this safe in the knowledge it wont be changed.

If it turns out the brightness parameter has a regression that will be reverted, I dont want to introduce a latent bug in my code!

Anyone?


Pre V1:

image.brightness( val ); // adjust the brighness by a value -1 to +1

REF: https://github.com/jimp-dev/jimp/blob/a4a8d6364bbf97629749e196f3b0a4c94c9a7abc/packages/jimp/README.md?plain=1#L217

This lines up with my expectation and experience.

Post V1:

brightness() brightness(val): Jimp

Adjusts the brightness of the image

REF: https://jimp-dev.github.io/jimp/api/jimp/classes/jimp/#brightness

Steve-Mcl avatar Jan 26 '25 10:01 Steve-Mcl

See breaking changes for v1.1.2, new behaviour is as expected

https://github.com/jimp-dev/jimp/releases/tag/v1.1.2

andrewdolphin avatar Mar 07 '25 11:03 andrewdolphin

See breaking changes for v1.1.2, new behaviour is as expected

https://github.com/jimp-dev/jimp/releases/tag/v1.1.2

Ok, thanks. I didn't find that since it was a patch version change

Do you not follow semver rules?

Steve-Mcl avatar Mar 09 '25 17:03 Steve-Mcl