COS has integrated Cloud Infinite (CI), a one-stop professional multimedia solution that offers the image processing features outlined below. For more information, see Image Processing Overview.
Service | Feature | Description |
---|---|---|
Basic image processing service | Scaling | Proportional scaling, scaling image to target width and height, and more |
Cropping | Cut (regular cropping), crop (scaling and cropping), iradius (inscribed circle cropping), and scrop (smart cropping) | |
Rotation | Adaptive rotation and common rotation | |
Format conversion | Format conversion, GIF optimization, and progressive display | |
Quality conversion | Changes the quality of images in JPG and WEBP formats | |
Gaussian blur | Blurs images | |
Sharpening | Sharpens images | |
Watermarking | Image watermarks, text watermarks | |
Obtaining image information | Basic information, EXIF data, average hue | |
Removing metadata | Includes EXIF data | |
Quick thumbnail template | Performs quick format conversion, scaling, and cropping to generate thumbnails | |
Setting style | Sets image styles to easily manage images for different purposes |
For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.
The following example shows how COS automatically processes an image when you upload it.
Upon successful upload, COS will save both the original and processed images. You can obtain the processing result using a common download request.
Objective-C
QCloudPutObjectWatermarkRequest* put = [QCloudPutObjectWatermarkRequest new];
// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "dir1/object1"
put.object = @"exampleobject";
// Bucket name in the format: `BucketName-APPID`
put.bucket = @"examplebucket-1250000000";
put.body = [@"123456789" dataUsingEncoding:NSUTF8StringEncoding];
QCloudPicOperations * op = [[QCloudPicOperations alloc]init];
// Indicate whether to return information on the original image. “0” (default): no; “1”: yes.
op.is_pic_info = NO;
QCloudPicOperationRule * rule = [[QCloudPicOperationRule alloc]init];
// File path of the processing result. If it starts with “/”, the result is stored in the specified folder. Otherwise, it is stored in the same directory as the original image file.
rule.fileid = @"test";
Note:
For the complete sample, go to GitHub.
Swift
let put = QCloudPutObjectWatermarkRequest<AnyObject>();
// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "dir1/object1"
put.object = "exampleobject";
// Bucket name in the format: `BucketName-APPID`
put.bucket = "examplebucket-1250000000";
put.body = "123456789".data(using: .utf8)! as NSData;
let op = QCloudPicOperations.init();
// Indicate whether to return information on the original image. “0” (default): no; “1”: yes.
op.is_pic_info = false;
let rule = QCloudPicOperationRule.init();
// File path of the processing result. If it starts with “/”, the result is stored in the specified folder. Otherwise, it is stored in the same directory as the original image file.
rule.fileid = "test";
Note:
For the complete sample, go to GitHub.
Was this page helpful?