jimp-dev / jimp-dev/jimp

brighten differs from pre v1

Open
#1,371 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/user-attachments/assets/656484ac-05a7-4023-94cf-3ac72760c72f)

# 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](https://github.com/user-attachments/assets/426d0786-2ed2-4190-91e3-7f283f7464d8)

# Failure Information (for bugs)

## Steps to Reproduce

#### Demonstrating -0.5 brightness
1. load image
1. ![image](https://github.com/user-attachments/assets/d801de4d-acb8-47b5-b568-3af0676185bb)
2. invert
1. ![image2](https://github.com/user-attachments/assets/9a734c58-2cce-4092-a218-fd312d4e5db4)
3. apply brightness -0.5
1. ![image3](https://github.com/user-attachments/assets/03eed4f9-7b4b-451b-9cf4-300f95513fba)

#### Demonstrating -0.0 brightness
1. load image
1. ![image](https://github.com/user-attachments/assets/d801de4d-acb8-47b5-b568-3af0676185bb)
2. invert
1. ![image2](https://github.com/user-attachments/assets/9a734c58-2cce-4092-a218-fd312d4e5db4)
3. apply brightness -0.0
1. ![image3](https://github.com/user-attachments/assets/a930465d-f883-4475-a257-41fa9bb981cb)

#### Demonstrating 1.0 brightness
1. load image
1. ![image](https://github.com/user-attachments/assets/d801de4d-acb8-47b5-b568-3af0676185bb)
2. invert
1. ![image2](https://github.com/user-attachments/assets/9a734c58-2cce-4092-a218-fd312d4e5db4)
3. apply brightness 1.0
1. ![image3](https://github.com/user-attachments/assets/53220a3c-c18e-4a07-ace1-d27162c9e017)

## Context

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

## Failure Logs

Contributor guide

Open the contributing guide

Research direction

Start at Jimp's brightness API and reproduce the reported values with Jimp 1.6.0, comparing them with the v0.x behavior described in the issue. Trace how values from -1 through 1 are interpreted and verify that zero, positive, and fractional values match the stated expected behavior when the fix is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.