Data Processing
Data processing provides rich file processing capabilities, allowing cloud-based processing without downloading files.
Image Processing
Perform operations such as cropping, scaling, watermarking, and format conversion on images to optimize user experience and save bandwidth costs.
After activation:
- ✅ Basic Image Processing: Enabled by default, can be used directly
- ⚙️ Smart Image Compression: Requires manual activation
- ⚙️ Advanced Image Compression: Requires manual activation
| Feature | Description |
|---|---|
| Basic Image Processing | Supports cropping, scaling, rotation, format conversion, quality adjustment, Gaussian blur, sharpening, and other operations |
| Smart Image Compression | Supports automatic compression when accessing images without parameters, or active compression through processing parameter imageSlim. Supports JPG, static PNG, GIF formats. Compression does not change image format |
| Advanced Image Compression | Converts images to AVIF, HEIF, TPG, ASTC compression formats through processing parameter imageMogr2/format. Also supports SVG image compression |
Document Processing
Convert documents to HTML or images to enable online preview functionality.
CloudBase Cloud Storage currently supports the following document processing features:
- ✅ Document to HTML: Supports converting Word, Excel, PPT, PDF, and other formats to HTML for online preview
- ✅ Document to Image: Supports converting documents to image formats (PNG, JPG)
Not currently supported: Video and audio multimedia processing features.
| Feature | Description | Supported Formats |
|---|---|---|
| Document to HTML | Convert documents to HTML for online preview | Word, Excel, PPT, PDF, etc. |
| Document to Image | Convert documents to image format | Word, Excel, PPT, PDF, etc. |
Use Cases:
- Online Document Viewing: Preview documents in browser without downloading
- Document Content Display: Display document content as images or HTML in applications
- Knowledge Base Systems: Document content search and display
Operation Steps
Basic Image Processing
Basic image processing supports real-time image processing through URL parameters without pre-configuration. Enabled by default.
You can access CloudDev Platform - Cloud Storage page, click "Go to COS Bucket", and find "Basic Image Processing" module in the left menu "Data Processing" → "Image Processing".
1. Process Using URL Parameters
Simply add processing parameters after the image access URL:
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg?imageMogr2/thumbnail/!50p
To get temporary access links for images in cloud storage, please refer to Get Temporary Link.
2. Common Processing Parameters
| Operation | Parameter | Value | Example |
|---|---|---|---|
| Scale·Scale by percentage | imageMogr2/thumbnail/!<Scale>p | 1-1000, e.g. 50p | imageMogr2/thumbnail/!50p |
| Scale·Specify width, scale proportionally | imageMogr2/thumbnail/<W>x | 1-10000, e.g. 200x | imageMogr2/thumbnail/200x |
| Scale·Specify height, scale proportionally | imageMogr2/thumbnail/x<H> | 1-10000, e.g. 200 | imageMogr2/thumbnail/x200 |
| Scale·Limit max width/height, scale proportionally | imageMogr2/thumbnail/<W>x<H> | 1-10000 | imageMogr2/thumbnail/200x200 |
| Scale·Force scaling (may distort) | imageMogr2/thumbnail/<W>x<H>! | 1-10000 | imageMogr2/thumbnail/200x200! |
| Crop·Custom crop | imageMogr2/cut/<W>x<H>x<dx>x<dy> | width × height × x-offset × y-offset | imageMogr2/cut/600x600x100x10 |
| Crop·Scale-crop (specify anchor) | imageMogr2/crop/<W>x<H>/gravity/<pos> | pos: center / north / south, etc. (3×3 grid) | imageMogr2/crop/300x400/gravity/center |
| Crop·Rounded-corner crop | imageMogr2/rradius/<radius> | 1 ~ half of the shortest side | imageMogr2/rradius/100 |
| Rotate·Clockwise rotation | imageMogr2/rotate/<deg> | 0-360, e.g. 90 | imageMogr2/rotate/90 |
| Format·Format conversion | imageMogr2/format/<type> | jpg / png / webp / gif / heif / avif / tpg / astc / src | imageMogr2/format/webp |
| Format·Transcode static & animated separately | imageMogr2/format/<a>/anima-format/<b> | animated supports gif / png / webp / avif | imageMogr2/format/jpg/anima-format/gif |
| Quality·Relative quality (% of original) | imageMogr2/rquality/<v> | 0-100 | imageMogr2/rquality/60 |
| Quality·Minimum quality (floor boost) | imageMogr2/lquality/<v> | 0-100 | imageMogr2/lquality/80 |
| Effect·Gaussian blur | imageMogr2/blur/<r>x<s> | 1-500 on download, 1-50 on upload | imageMogr2/blur/8x5 |
| Effect·Sharpen | imageMogr2/sharpen/<v> | 10-300, recommended 70 | imageMogr2/sharpen/70 |
| Effect·Brightness | imageMogr2/bright/<v> | -100 ~ 100 | imageMogr2/bright/70 |
| Effect·Contrast | imageMogr2/contrast/<v> | -100 ~ 100 | imageMogr2/contrast/-50 |
3. Create Image Style (Optional)
If you need to reuse the same processing rules, you can create image styles:
- Access CloudDev Platform - Cloud Storage page and click "Go to COS Bucket"
- In the left menu "Data Processing" → "Image Processing", click "Style Management" → "Add Style"
- Configure processing parameters and name the style (e.g.,
thumbnail) - Use style:
image.jpg?imageView2/style/thumbnail
4. Advanced Processing Examples
# Scale + Format Conversion + Quality Adjustment (combined use)
https://example.com/image.jpg?imageMogr2/thumbnail/!50p/format/webp/rquality/80
# Crop + Rotate
https://example.com/image.jpg?imageMogr2/crop/300x300/rotate/90
# Add Text Watermark
https://example.com/image.jpg?watermark/2/text/Q2xvdWRCYXNl/font/SGVsdmV0aWNh/fontsize/30/fill/IzAwMDAwMA==/dissolve/80/gravity/southeast/dx/10/dy/10
Smart Image Compression
Smart image compression can significantly reduce image size while maintaining visual quality. Supports JPG, static PNG, GIF formats. Compression does not change image format.
1. Activate Smart Compression
- Access CloudDev Platform - Cloud Storage page and click "Go to COS Bucket"
- Find "Smart Image Compression" module in the left menu "Data Processing" → "Image Processing"
- Click "Activate Service" and confirm activation (billed by number of calls)
2. Use Smart Compression
Two methods available:
Method 1: Auto Compression (Recommended)
No additional parameters needed. Images in JPG, PNG, GIF formats will be automatically compressed when accessed normally:
# Direct access to image, auto compression
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg
Method 2: API Compression
When accessing an image, add the smart compression parameter imageSlim after the image link to access the compressed image:
# Use imageSlim parameter for active compression
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg?imageSlim
For more detailed parameter descriptions, please refer to Smart Image Compression Interface Description.
3. Compression Effect Comparison
Smart compression can significantly reduce file size without changing image format:
| Format | Before Compression | After Compression | Compression Rate | Visual Quality |
|---|---|---|---|---|
| JPG | 500 KB | 250 KB | 50% | No noticeable difference |
| PNG | 800 KB | 400 KB | 50% | No noticeable difference |
| GIF | 1 MB | 500 KB | 50% | No noticeable difference |
Advanced Image Compression
Advanced image compression converts images to high compression rate formats like AVIF, HEIF, TPG, ASTC through the imageMogr2/format parameter. Also supports SVG image compression.
1. Enable Advanced Compression
- Access CloudDev Platform - Cloud Storage page and click "Go to COS Bucket"
- Find "Advanced Image Compression" option in the left menu "Data Processing" → "Image Processing"
- Click "Activate Service" and confirm activation (billed by number of calls)
2. Supported Compression Formats
| Format | Parameter | Compression Rate | Compatibility |
|---|---|---|---|
| HEIF | imageMogr2/format/heif | More than 80% smaller than JPG | iOS 11+, Android P+ native support |
| AVIF | imageMogr2/format/avif | Next-generation format, highest compression rate | Chrome 85+, Firefox 93+ |
| TPG | imageMogr2/format/tpg | Tencent's proprietary format, extremely high compression rate | Requires client SDK support |
| ASTC | imageMogr2/format/astc | Suitable for texture compression | OpenGL ES 3.0+ |
3. Usage Methods
Method 1: Process on Download (Not Saved)
Add processing parameters after image access URL:
# Convert to HEIF format
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg?imageMogr2/format/heif
# Convert to AVIF format
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg?imageMogr2/format/avif
# Convert to TPG format
https://your-bucket.cos.ap-region.myqcloud.com/image.jpg?imageMogr2/format/tpg
Method 2: Process on Upload (Save Result)
Process and save during image upload:
// Add Pic-Operations in request header
{
"is_pic_info": 1,
"rules": [{
"fileid": "compressed-image.heif",
"rule": "imageMogr2/format/heif"
}]
}
Method 3: Cloud Data Processing (Process Existing Images)
Process and save existing stored images:
POST /<ObjectKey>?image_process HTTP/1.1
# Request body same as upload processing
4. Compression Effect Comparison
| Format | File Size | Compression Rate | Use Case |
|---|---|---|---|
| Original (PNG) | 1335.2 KB | - | Original image |
| HEIF | 52.87 KB | 96.0% | iOS/Android mobile |
| AVIF | ~50 KB | 96.3% | Modern browsers |
| TPG | ~55 KB | 95.9% | Tencent ecosystem apps |
Document to HTML
Convert documents to HTML format for online preview functionality.
1. Activate Document Preview Service
- Access CloudDev Platform - Cloud Storage page and click "Go to COS Bucket"
- Click "Activate Service" in the left menu "Data Processing" → "Document Processing"
- Confirm activation of document preview feature
2. Use Document to HTML
Preview documents directly through URL parameters:
https://your-bucket.cos.ap-region.myqcloud.com/document.pdf?ci-process=doc-preview&dstType=html
Core Parameters:
| Parameter | Required | Description | Value |
|---|---|---|---|
ci-process | Yes | Specify Cloud Infinite processing capability | Fixed as doc-preview |
dstType | Yes | Output target file type | Fixed as html (lowercase) |
srcType | No | Input source file type | If not filled, auto-detect based on file extension (e.g., pptx, pdf, docx) |
sign | No | Object download signature | Required for private read files, needs URLencode |
copyable | No | Whether to allow content copying | 1=copyable (default), 0=not copyable |
htmlParams | No | Custom configuration parameters (JSON) | Requires URL-safe Base64 encoding |
htmlwaterword | No | Watermark text content | Requires URL-safe Base64 encoding |
htmlfillstyle | No | Watermark color and transparency | RGBA format (e.g., rgba(192,192,192,0.6)), requires Base64 encoding |
htmlfront | No | Watermark text style | e.g., bold 20px Serif, requires Base64 encoding |
htmlrotate | No | Watermark rotation angle | 0-360, default 315 |
htmlhorizontal | No | Watermark horizontal spacing | Unit px, default 50 |
htmlvertical | No | Watermark vertical spacing | Unit px, default 100 |
Usage Examples:
# Basic preview
https://your-bucket.cos.ap-region.myqcloud.com/test.pptx?ci-process=doc-preview&dstType=html
# Disable copying + Add watermark (Base64 encoding of "test" is dGVzdAog)
https://your-bucket.cos.ap-region.myqcloud.com/test.pptx?ci-process=doc-preview&dstType=html©able=0&htmlwaterword=dGVzdAog
# Switch to English interface (htmlParams requires Base64 encoding)
https://your-bucket.cos.ap-region.myqcloud.com/test.pptx?ci-process=doc-preview&dstType=html&htmlParams=eyJjb21tb25PcHRpb25zIjp7Imxhbmd1YWdlIjoiZW4ifX0
htmlParams Configuration Example:
// Hide header, switch language to English
{
"mode": "normal",
"commonOptions": {
"isShowHeader": false,
"language": "en"
}
}
// Use as htmlParams parameter value after encoding