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 Example | Description |
|---|---|---|
| Proportional Scaling | imageMogr2/thumbnail/500x | Specify width as 500px, height scales proportionally |
| Force Scaling | imageMogr2/thumbnail/!300x200 | Force scale to 300x200 pixels (ignore aspect ratio) |
| Scale by Percentage | imageMogr2/thumbnail/!50p | Scale to 50% of original |
| Regular Cropping | imageMogr2/crop/300x300x10x10 | Crop 300x300 pixel area starting from coordinates (10,10) |
| Smart Cropping | imageMogr2/crop/300x300/gravity/face | Smart crop 300x300 pixels based on face position |
| Rotation | imageMogr2/rotate/90 | Rotate 90 degrees clockwise |
| Format Conversion | imageMogr2/format/webp | Convert to WebP format |
| Quality Adjustment | imageMogr2/quality/85 | Adjust image quality to 85 (range 1-100) |
| Gaussian Blur | imageMogr2/blur/3x5 | Gaussian blur with radius 3 and standard deviation 5 |
| Sharpening | imageMogr2/sharpen/3 | Sharpen with radius 3 |
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/quality/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
For detailed usage instructions, please refer to Document to HTML Usage Guide.
3. Supported Document Formats
- Presentation Files: pptx, ppt, pot, potx, pps, ppsx, dps, dpt, pptm, potm, ppsm
- Text Files: doc, dot, wps, wpt, docx, dotx, docm, dotm
- Spreadsheet Files: xls, xlt, et, ett, xlsx, xltx, xlsb, xlsm, xltm, ets
- Other Formats: pdf, txt, log, xml, htm, html, code files, etc.
4. Notes
- File Size Limit: Input file size must be within 200MB
- Page Limit: Input file page count limited to 5000 pages
- Encoding Requirement: String parameters like
htmlParams,htmlwaterwordmust be URL-safe Base64 encoded - Permission Requirement: Private read files must pass
signparameter for authentication
Document to Image
Convert each page of a document to image format.
1. Convert Using URL Parameters
Convert documents to images in real-time through URL parameters:
https://your-bucket.cos.ap-region.myqcloud.com/document.pdf?ci-process=doc-preview&page=1&dstType=png
Core Parameters:
| Parameter | Description | Value |
|---|---|---|
ci-process | Required, specify Cloud Infinite processing capability | Fixed as doc-preview |
page | Optional, document page number to convert | Integer, starts from 1, default converts page 1 |
dstType | Optional, output image format | png or jpg, default is jpg |
srcType | Optional, source file extension type | Specify when file has no extension (e.g., pptx, pdf, docx) |
scale | Optional, preview image scale ratio | 10-200, default 100 (i.e., 100%) |
quality | Optional, generated image quality | 1-100, default 100 |
imageDpi | Optional, render image at specified DPI | 96-600, default 96 (Note: high DPI increases processing time) |
Usage Examples:
# Basic conversion: convert page 1 to PNG
https://your-bucket.cos.ap-region.myqcloud.com/document.pdf?ci-process=doc-preview&page=1&dstType=png
# Specify quality and scale: convert to JPG, quality 85, scale 50%
https://your-bucket.cos.ap-region.myqcloud.com/document.pdf?ci-process=doc-preview&page=1&dstType=jpg&quality=85&scale=50
# Combine with image processing: add watermark after conversion (requires URL encoding)
https://your-bucket.cos.ap-region.myqcloud.com/test.pptx?ci-process=doc-preview&page=1&ImageParams=imageMogr2/thumbnail/!50p|watermark/2/text/dGVzdA/fontsize/30
- Document to Image Usage Guide
- Supports combining with Image Processing features (such as scaling, watermarking, cropping, etc.) through
ImageParamsparameter
2. Supported Document Formats
- Microsoft Office: Word (.doc/.docx), Excel (.xls/.xlsx), PowerPoint (.ppt/.pptx)
- PDF Documents (.pdf)
3. Notes
- Timeout Limit: Synchronous interface defaults to 10-second conversion timeout, suitable for documents within a hundred pages or previewing a few pages
- File Limit: Input file size limited to 200MB, page count limited to 5000 pages
- Private Read Buckets: URL needs to carry COS authorization signature
FAQ
Q: Will image processing modify the original image?
A: No. Image processing is real-time and does not modify the original file. Processed images are dynamically generated on access.
Q: How to save processed images?
A: Two methods:
- Persistent Processing: Add
|saveasparameter in processing parameters to save processing result as new file - Download and Upload: Download processed image locally, then upload to bucket
Q: Will processed images be cached?
A: Yes. Processed images will be cached at CDN nodes. Subsequent access to the same URL returns cached results without repeated processing.
Q: Does document preview support encrypted documents?
A: Currently does not support encrypted document preview. Documents need to be decrypted before uploading to bucket for preview.
Q: How to batch process images?
A: Can use the following methods:
- Workflow: Create workflow in console to automatically process newly uploaded files
- Batch Processing Task: Create batch processing task in console to process existing files
- SDK: Traverse file list through code and call processing API