The saturation of meitu xiuxiu filter and the filter saturation of xiuxiu Filter

Source: Internet
Author: User

The saturation of meitu xiuxiu filter and the filter saturation of xiuxiu Filter

Saturation refers to the brightness of the color, also known as the purity of the color. The saturation is determined by the ratio of the color-containing component and the color-removing component (Gray) in the color. The greater the color composition, the greater the saturation. The greater the color composition, the smaller the saturation. Pure colors are highly saturated, such as bright red and fresh green. Mixed with white, gray, or other colors, is not saturated color, such as purple, pink, Yellow Brown. Completely unsaturated colors have no tones at all, such as various gray colors between black and white.

Use the GPUImageSaturationFilter class in GPUImage to adjust the image saturation.

Segment coloring

 varying highp vec2 textureCoordinate;  uniform sampler2D inputImageTexture; uniform lowp float saturation;  // Values from "Graphics Shaders: Theory and Practice" by Bailey and Cunningham const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);  void main() {    lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);    lowp float luminance = dot(textureColor.rgb, luminanceWeighting);    lowp vec3 greyScaleColor = vec3(luminance);        gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);      }

 

Specific Application

 

+ (UIImage *)changeValueForSaturationFilter:(float)value image:(UIImage *)image;{    GPUImageSaturationFilter *filter = [[GPUImageSaturationFilter alloc] init];    filter.saturation = value;    [filter forceProcessingAtSize:image.size];    GPUImagePicture *pic = [[GPUImagePicture alloc] initWithImage:image];    [pic addTarget:filter];        [pic processImage];    [filter useNextFrameForImageCapture];    return [filter imageFromCurrentFramebuffer];}

 

 

Effect

High saturation and low saturation [black and white]

 

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.