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

Index Slicing

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2025-12-25 11:47:03

Feature Overview

Cloud Infinite provides image indexing and splitting function through the imageMogr2 API. It can split images into specified sizes and extract the specific block. 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.
Processing 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.

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/indexcrop/width/<width>
/height/<height>
/index/<index> 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/indexcrop/width/<width>
/height/<height>
/index/<index>"
}]
}

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/indexcrop/width/<width>
/height/<height>
/index/<index>"
}]
}
Note:
Authorization: A request header that carries authentication information and is used to verify the legitimacy of requests. The Pic-Operations header must be included in the signature information. For details, see the 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 file will overwrite the original file storage; if they are different, the original file and the processed file will be stored separately.
The value of fileid needs to be passed through URL-safe Base64 encoding.

Processing Parameter Description

Parameter
Description
Type
Required
ObjectKey
Object filename, for example folder/sample.jpg.
String
Yes
indexcrop/width/<width>
Specify the length of each area divided by horizontal cuts, in pixels. The value must be a positive integer greater than 0 and not exceeding the image width.
Note: You may only use either the <width> or <height> parameter.
Int
Yes
indexcrop/height/<height>
Specify the length of each area divided by vertical cuts, in pixels. The value must be a positive integer greater than 0 and not exceeding the image height.
Note: You may only use either the <width> or <height> parameter.
Int
Yes
indexcrop/index/<index>
Index value of the image area, default value is 0, which means taking the first block.
Int
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:
If the specified index value is greater than the number of regions formed after slicing, the original image will be returned.
When both <width> and <height> are specified with valid values, the <height> parameter takes precedence.

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 Image Processing Mechanism document and configure process during upload or processing in the cloud.

Case 1: Index Slicing in Horizontal Direction

The original image URL of the example is as follows:
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg



Slice the original image horizontally at 100 pixels and take the first segmented area. The processed image link is as follows:
https://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?imageMogr2/indexcrop/width/100/index/0
Post-segmentation image is as follows:




Case 2: Extract a Square Area by Combining Horizontal and Vertical Index Slicing

Slice the image horizontally at 100 pixels and connect using the Pipeline Operator, then slice vertically at 100 pixels and take the first segmented area. The processed image link is as follows:
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?imageMogr2/indexcrop/width/100/|imageMogr2/indexcrop/height/100/index/1/
Post-segmentation image is as follows:




Case 3: Index Slicing in Horizontal Direction and Carry a Private File Signature

Use the same processing method, only add the signature part, and connect it with the image processing parameters using "&". The example is as follows:
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?q-sign-algorithm=<signature>&imageMogr2/indexcrop/width/100/index/0
Note:
<signature> is the signature part. To obtain it, please refer to Request Signature documentation.


Ajuda e Suporte

Esta página foi útil?

comentários