tencent cloud

Cloud Infinite

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Product Overview
Product Strengths
Use Cases
Feature Overview
Regions and Domains
Specifications and Limits
Billing
Billing Overview
Billing Mode
Billable Items
Free Tier
Payment Overdue
Viewing Bill Details
FAQs
Getting Started
Registering and Logging In
Bind Bucket
Uploading and Processing File
Downloading and Deleting Images
Unbinding Buckets
Using CI via COS
Features
Image Processing
Media Processing
Content Moderation
AI Content Recognition
File Processing
Smart Voice
File processing
User Guide
Overview
Bucket Management
Smart Toolbox
Job and Workflow
Data Monitoring
Usage statistics
Use Cases
Copyright Protection Solutions
Image Processing Practices
Working with API Authorization Policies
Workflow Practices
API Documentation
API Overview
Structure
Common Request Headers
Common Response Headers
Activate Vast Service
Image Processing
AI-Based Content Recognition
Smart Audio
Media Processing
Content Moderation
Document Processing
File Processing
Job and Workflow
Cloud Virus Detection
Error Codes
Request Signature
SDK Documentation
SDK Overview
Android SDK
iOS SDK
COS Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Go SDK
COS iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
Mini Program SDK
Personal Information Protection Policy for SDK
Security and Compliance
Permission ‍Management
FAQs
Basic Settings
Document Processing
Media Processing
Content Recognition
Smart Audio
Agreements
Service Level Agreement
Contact Us
Glossary

GIF Frame Extraction

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-12-25 11:52:17

Feature Overview

Cloud Infinite provides GIF frame extraction functionality through the imageMogr2 API. This feature supports the following processing methods:
Processing during download
Processing during upload
Processing in the cloud

Authorization Guide

When used with a sub-account, corresponding permissions must be granted. For details, please refer to Cloud Object Storage. For other CI permissions, please refer to Cloud Infinite.
Processing during download: Set action to cos:GetObject in the authorization policy.
Process upon upload: Set action to cos:PutObject in the authorization policy.
Cloud data processing: Set action to cos:PutObject in the authorization policy.
Note:
The resource corresponding to GetObject is the source file, and the resource corresponding to PutObject is the transferred file.

Service Activation

Using this feature will activate Cloud Infinite for you by default and bind a bucket. No role authorization is required, it can be used directly.

Use Limits

When using this API, please first confirm the relevant restrictions. For details, see Specifications and Limits.
Supported formats: Supports processing GIF, WebP formats.
Volume limit: GIF original image width × height × frame count not exceeding 250 million pixels; WebP original image width and height not exceeding 16,383 pixels.
Animated image frame limit: Number of frames limited to 300.

Fee Description

This API is a paid service. The incurred fees will be collected by Cloud Infinite. For detailed billing information, see Image Processing Fees.
If processing during download is adopted and the download is performed via the public network, the API call will incur Traffic Fees.

API Example

1. Processing during download

GET /<ObjectKey>?imageMogr2/cgif/<FrameNumber>
/egif/<FrameInterval> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Note:
Ignore the spaces and line breaks above.

2. Processing during upload

PUT /<ObjectKey> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Pic-Operations:
{
"is_pic_info": 1,
"rules": [{
"fileid": "exampleobject",
"rule": "imageMogr2/cgif/<FrameNumber>
/egif/<FrameInterval>"
}]
}

3. Processing in the cloud

POST /<ObjectKey>?image_process HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-length: Size
Authorization: Auth String
Pic-Operations:
{
"is_pic_info": 1,
"rules": [{
"fileid": "exampleobject",
"rule": "imageMogr2/cgif/<FrameNumber>
/egif/<FrameInterval>"
}]
}
Note:
Authorization: Auth String. For details, see Request Signature documentation.
Pic-Operations is a JSON format string. For specific parameter details, refer to Persistent Image Processing.
When fileid is the same as ObjectKey, the processed image will overwrite the original image storage; if they are different, both the original image and the processed image will be stored separately.
The value of fileid needs to be passed through URL-safe Base64 encoding.

Processing Parameter Description

Parameter
Meaning
Type
Required
ObjectKey
Object filename, for example folder/sample.gif.
String
Yes
/frame/
Extract a single frame from a GIF (processing during download only): You can specify to extract the Nth frame of the GIF, where N is a positive integer (1, 2, 3...). If N exceeds the maximum frame number of the GIF, the last frame will be taken. For example, to extract the 1st frame of a GIF, the parameter is /frame/1.
Int
No
/cgif/
GIF format optimization (frame extraction type): Optimized for original images in GIF or WebP format, this optimization involves extracting frames and reducing image colors. It is divided into the following two scenarios:
If FrameNumber = 1, the default frame count of 30 is used. If the image frame number is larger than this, frames will be extracted to reduce to 30.
If FrameNumber is in the range (1,100], the image will be compressed to the specified number of frames (FrameNumber).
String
No
/egif/
GIF format optimization (frame sampling type): Optimized for original images in GIF or WebP format, this optimization involves reducing image colors and extracting target frames at a certain frame interval (FrameInterval) for output.
FrameInterval takes values in the range [1,10].
String
No
/ignore-error/1
When processing requests carry this parameter, if operations fail due to oversized files or parameter exceeds limit, it will directly return the original image without reporting an error.
String
No
Note:
When both cgif and egif parameters are selected, prioritize processing cgif.

Practical Example

Note:
The examples in this documentation contain only processing during download. This type of processing will not save the processed images to the storage bucket. If you have a need to save, you can check the Persistent Image Processing document and configure processing during upload or processing in the cloud.
Capture the first 10 frames of a GIF:
http://examples-125xxxxxx.cos.ap-shanghai.myqcloud.com/sample.gif?imageMogr2/cgif/10

Important Notes

To prevent unauthorized personnel from accessing and downloading the original images through links that do not carry processing parameters, you can include the processing parameters in the request signature. The processing parameters are the key in the parameters with an empty value. A simple example is provided below (for reference only; the link may be expired and inaccessible). For detailed calculation methods, please refer to Request Signature.
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?q-sign-algorithm=sha1&q-ak=**********************************&q-sign-time=1593342360;1593342720&q-key-time=1593342360;1593342720&q-header-list=&q-url-param-list=watermark%252f1%252fimage%252fahr0cdovl2v4yw1wbgvzlteyntewmdawmdqucgljc2gubxlxy2xvdwquy29tl3nodwl5aw4uanbn%252fgravity%252fsoutheast&q-signature=**************************************&watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/southeast


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan