tencent cloud

Feedback

Image Advanced Compression

Last updated: 2024-02-05 11:05:12

    Overview

    This document provides an overview of APIs and SDK code samples for image advanced compression.
    API
    Description
    Compresses an image in a specified bucket.

    Image Advanced Compression

    Feature description

    CI uses the imageMogr2 API to provide the image advanced compression feature.

    Method prototype

    ci_download_compress_image(self, Bucket, Key, DestImagePath, CompressType, **kwargs)

    Sample request

    # TPG compression
    response = client.ci_download_compress_image(
    Bucket='examplebucket-1250000000',
    Key='sample.png',
    DestImagePath='sample.tpg',
    CompressType='tpg'
    )
    
    # HEIF compression
    response = client.ci_download_compress_image(
    Bucket='examplebucket-1250000000',
    Key='sample.png',
    DestImagePath='sample.heif',
    CompressType='heif'
    )

    Parameter description

    Parameter
    Description
    Type
    Required
    Bucket
    Bucket name in the format of BucketName-APPID. For more information, see Bucket Overview.
    String
    Yes
    Key
    Object key. It can contain up to 128 bytes of letters, digits, spaces, plus signs, minus signs, underscores, equal signs, dots, colons, and slashes.
    String
    Yes
    DestImagePath
    Local path to save the compressed image
    String
    Yes
    CompressType
    Compression format, which can be TPG or HEIF.
    String
    Yes

    Response description

    This API returns the response header.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support