Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a wrong contrast range in function description? #2

Open
scarl555 opened this issue Jun 21, 2016 · 1 comment
Open

Is there a wrong contrast range in function description? #2

scarl555 opened this issue Jun 21, 2016 · 1 comment

Comments

@scarl555
Copy link

Hi, this is the function description of brightnessContrast

// brightnessContrast adjusts the brightness and contrast of the image.
// The brightness value ranges between -1 .. 1, with 0 being neutral.
// The contrast value ranges between 0 .. 127, with 1 being neutral.
ImageData brightnessContrast(ImageData pixels, float brightness, float contrast)

if i'm looking into the function your contrast will be calculated like this:
contrastAdjust = -128*contrast + 128;
For a range from 0 to 127 i get values from 128 to -16.128. I uses the function parallel to PHP GD imagefilter. I create a live editing image with javascript and on save I generate an image with PHP and the images doesn't match. If I choose a range from 0 to 2 with 1 being neutral. I get values from 128 to -128 this machtes with the PHP imagefilter contrast range and I get two images they were very similar.

Is there a fault in my mind or in the function description?

Greetings
Simon

@kig
Copy link
Owner

kig commented Jun 21, 2016

Yep, if the code doesn't match the function description, we should change
one.

On 21 June 2016 at 12:50, scarl555 [email protected] wrote:

Hi, this is the function description of brightnessContrast

// brightnessContrast adjusts the brightness and contrast of the image.
// The brightness value ranges between -1 .. 1, with 0 being neutral.
// The contrast value ranges between 0 .. 127, with 1 being neutral.
ImageData brightnessContrast(ImageData pixels, float brightness, float
contrast)

if i'm looking into the function your contrast will be calculated like
this:
contrastAdjust = -128*contrast + 128;
For a range from 0 to 127 i get values from 128 to -16.128. I uses the
function parallel to PHP GD imagefilter. I create a live editing image with
javascript and on save I generate an image with PHP and the images doesn't
match. If I choose a range from 0 to 2 with 1 being neutral. I get values
from 128 to -128 this machtes with the PHP imagefilter contrast range and I
get two images they were very similar.

Is there a fault in my mind or in the function description?

Greetings
Simon


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2, or mute the thread
https://github.com/notifications/unsubscribe/AAANtF1s4A-nZ_9BfHY9vTOpBcyBhqI9ks5qN8_xgaJpZM4I6pTf
.

Ilmari Heikkinen

Web http://fhtr.net | Mail [email protected] | Skype ilmarihe | Twitter
@ilmarihei
Tel (UK) +447427139588

FHTR Ltd

Creative dev in London, working with agencies & artists to build campaign
websites, installations and innovative prototypes.

Company Number. 8157370
Registered in England

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants