JavaScript image processing: brightness contrast

Source: Internet
Author: User

Objective

In the previous article, we explained the convolution operation and smoothing (i.e. fuzzy) processing in the image processing, this article we carry on the brightness and the contrast change.

Actually, what is brightness?

Brightness is more bright eye slightly ...

In fact, for RGBA color space, brightening is equal to R, G, b three channels at the same time increase, then the dimming is equal to the reduction at the same time.

This is better understood because the darkest black is RGB (0,0,0), and the brightest white is RGB (255,255,255). So lighten should be RGB each channel to increase.

So, what's the contrast?

Contrast, in fact, is the color of the poor.

So for the RGBA color space, the contrast is actually equal to the R, G, b three channels multiplied by a ratio, because such a similar color gap between the larger, then the reduction is at the same time divided by slightly.

For example, the original RGB (23,44,55) and RGB (33,44,55) difference is only 10, but multiplied by 2, became RGB (46,88,110) and RGB (66,88,110), the difference became 20, that is, "color difference" has become larger.

Linear model

NEWRGB = contrast * RGB + brightness

The linear model satisfies the above formula, wherein contrast represents the contrast coefficient, and the brightness represents the brightness coefficient.

Linear model implementation is relatively simple, but it is easy to call out the whole white or black picture, for ordinary users contrast, brightness choose how much better also more difficult to determine.

So instead of using linear models in Photoshop, it's not a linear model.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.