Adjusting Contrast

Last updated: 2021-07-20 16:41:19

    Overview

    CI uses the imageMogr2 API to adjust an image’s contrast, which is the difference in luminance between the brightest and darkest points in an image (i.e., the contrast in grayscale).

    API Format

    download_url?imageMogr2/contrast/<value>
    

    Parameters

    Operation: contrast

    Parameter Description
    download_url URL of the input image, formatted as <bucketname-appid>.cos.<picture region="">.<domain>.com/<picture name="">
    Example: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpeg
    /contrast/&dxlt;value> Adjusts the contrast of an image. The value must be an integer in the range of [−100, 100].
  • value < 0: reduces the contrast.
  • value = 0: does not adjust the contrast.
  • value > 0: increases the contrast.
  • /ignore-error/1 If this parameter is carried and the image failed to be processed because it is too large, the input image will be returned with no error reported.

    Examples

    Adjusting contrast

    This example reduces the contrast of an image by 50:

    http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?imageMogr2/contrast/-50
    

    Output image:

    Adjusting contrast with a signature carried

    This example processes the image in the same way as in the example above except that a signature is added. The signature is joined with other processing parameters using an ampersand (&):

    http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?q-sign-algorithm=<signature>&imageMogr2/contrast/-50
    
    Note:

    You can obtain the value of <signature> by referring to Request Signature.