• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need a Hand with an Algorithm

Kntx

Platinum Member
I'm writing a quick helper function that coverts a JPEG compression level selected by a user [9=no compression, 1=maximum compression] to the value accepted by the function that does the compression [0=no compression, 255=maximum compression]. So anyways you could draw 0-9 on a the x-axis of a graph and 0-255 on the y-axis, then draw the line. So what is the equation of the line?? I feel like a blithering idiot that I don't remember how to do this, so to all you high school math students out there please lend a hand!!

Thanx!
 
Need more info on the relationship. You need to identify at least two points, if not more in order to calculate the equation. Are you saying the two points would be 9,0 and 1,255 ?

If so, then your equation is something like:

y = (-31.8750)(x - 9)

Slope(m) = (y2 - y1) / (x2 - x1)

line of best fit = (y - y1) = (m(x - x1))

x = user setting
y = compression function value

This assuming a linear relationship.
 
Back
Top