Skip to content

Commit

Permalink
Fixing regression with mask effect caused by contrast being adjusted …
Browse files Browse the repository at this point in the history
…after we modulate the brightness (sort error)
  • Loading branch information
jonoomph committed Nov 18, 2022
1 parent 7617e91 commit 553dcc6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/effects/Mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ std::shared_ptr<openshot::Frame> Mask::GetFrame(std::shared_ptr<openshot::Frame>
// Get the average luminosity
int gray_value = qGray(R, G, B);

// Adjust the brightness
gray_value += (255 * brightness_value);

// Adjust the contrast
float factor = (259 * (contrast_value + 255)) / (255 * (259 - contrast_value));
gray_value = constrain((factor * (gray_value - 128)) + 128);

// Adjust the brightness
gray_value += (255 * brightness_value);

// Constrain the value from 0 to 255
gray_value = constrain(gray_value);

Expand Down

0 comments on commit 553dcc6

Please sign in to comment.