Cloud Infinite

Cloud Infinite
Best Practices
Product Documentation©2013-2022 Tencent Cloud. All rights reserved.

Page 1 of 25

Cloud Infinite

Copyright Notice©2013-2024 Tencent Cloud. All rights reserved.
Copyright in this document is exclusively owned by Tencent Cloud. You must not reproduce, modify, copy or distributein any way, in whole or in part, the contents of this document without Tencent Cloud's the prior written consent.
Trademark Notice

All trademarks associated with Tencent Cloud and its services are owned by Tencent Cloud Computing (Beijing)
Company Limited and its affiliated companies. Trademarks of third parties referred to in this document are owned bytheir respective proprietors.
Service Statement
This document is intended to provide users with general information about Tencent Cloud's products and services
only and does not form part of Tencent Cloud's terms and conditions. Tencent Cloud's products or services are
subject to change. Specific products and services and the standards applicable to them are exclusively provided for in
Tencent Cloud's applicable terms and conditions.

©2013-2022 Tencent Cloud. All rights reserved.

Page 2 of 25

Cloud Infinite

Contents
Best Practices
Copyright Protection Solutions
Image Processing Practices
Downsizing Image with CI
Hybrid Watermarking
Workflow Practices
Using Custom Function to Manage COS Files©2013-2022 Tencent Cloud. All rights reserved.

Page 3 of 25

Cloud Infinite

Best Practices
Copyright Protection Solutions：

Last updated 2024-01-31 16:54:06

BackgroundAs the network infrastructure gets improved, various major platforms see an explosive growth of image and video
content volumes. While enjoying the profits of web and app traffic, creators and platforms also face the risks ofunauthorized content use and infringement upon intellectual property rights. To address these problems, CI provides
advanced features such as document watermark, visible and blind watermarks for images and videos, and video
DNA. These features make an easy-to-connect and cost-effective one-stop copyright protection solution suitable invarious business scenarios.

Overview of Image Copyright Protection Solutions
Visible image watermark
Visible image watermarks have been widely used on various social media and UGC platforms. The characteristics
and strengths of CI's visible watermark feature are as detailed below:
Text and image watermarks are supported.
Tiled watermark is supported.
It is easy to connect. Its GUI-based console allows you to preview the watermark effect in real time.
You can configure the watermark style and perform multiple image processing operations in one single API call.
The watermark is highly visible and has a good warning effect.
You can implement image processing during download by adding relevant parameters to the image download link in
COS as instructed in the product documentation. Below is a sample image link:©2013-2022 Tencent Cloud. All rights reserved.

Page 4 of 25

Cloud Infinite

https://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?watermark/2/te
Visible watermarks are suitable for scenarios where the brand awareness is high and the image copyright needs to behighlighted, such as product images. This solution has many strengths, including high cost-effectiveness, ease ofconfiguration, and low processing latency. However, if a visible watermark is smeared or covered, the image will lose
the protection. Moreover, it also compromises the visual experience. If you have high requirements for the watermark
protection capabilities and image quality, you can choose the blind watermark solution as described below.

Blind image watermark©2013-2022 Tencent Cloud. All rights reserved.

Page 5 of 25

Cloud Infinite

The blind watermark feature is a more secure watermark mode. It allows you to add a watermark to the input image
information without displaying the watermark or significantly affecting the image quality. If you think your image
might have been stolen, you can extract the blind watermark from the suspected image to prove that the image
belongs to you. A blind watermark has powerful protection capabilities. Even if an image is rotated, cropped,
smeared, or compressed, the decoding algorithm can still extract the watermark information in most cases. The
processes of adding and extracting a blind watermark are as shown below:

Overview of Video Copyright Protection Solutions
CI can hide images and strings in a video in a way they can hardly be detected or modified. By identifying thewatermark hidden in the video content, you can confirm the content creator, copyright owner, and spreaders andcheck whether the video content is tampered with. Such watermarks are difficult to detect or modify, yet they don'tcompromise the video integrity and watch experience.
A digital watermark is transparent, robust, secure, and traceable. Currently, CI's digital watermark service well
protects the copyright of content in Tencent services such as Tencent Video and WeChat Channels and has beencertified by ChinaDRM.

©2013-2022 Tencent Cloud. All rights reserved.

Page 6 of 25

Cloud Infinite

You can also customize the digital watermark content. The effects before and after a digital watermark is added are asshown below:

Note:
In addition to the video digital watermark feature, CI also offers other copyright protection solutions like video DNA andvideo encryption. To try them out, contact us for application.

Overview of File Copyright Protection Solutions
CI provides the following two file copyright protection solutions for your choice as needed:

Using image processing to convert files to watermarked images
CI's file transcoding feature can transcode a COS file to images by adding parameters to the file download link. It can
add a custom watermark at the same time by adding watermark parameters to the link. This feature implements
lightweight file distribution while preventing the file content from being stolen. Below is a sample file link:©2013-2022 Tencent Cloud. All rights reserved.

Page 7 of 25

Cloud Infinite

https://ci-h5-demo-1258125638.cos.ap-chengdu.myqcloud.com/defaults/defaultSlides.pp

Converting files into watermarked HTML webpages
The file-to-HTML conversion feature allows you to directly view the file content on a webpage while retaining fileinteractions, such as animations and transitions in slides as well as sheet switch in spreadsheets on the webpage.
You can also add relevant parameters to the file link to convert the file and configure watermark and copy
protection features. Below is a sample file link:©2013-2022 Tencent Cloud. All rights reserved.

Page 8 of 25

Cloud Infinite

https://ci-h5-demo-1258125638.cos.ap-chengdu.myqcloud.com/defaults/defaultSlides.pp

Directly adding watermarks to PDF files
You can upload a PDF file to a bucket and call the PDF watermark API to add a watermark to it. In addition, you canalso set the bucket access permission to private-read and generate a signature for the file link with parameters. This
prevents the original file from being read without authorization.
Note:
This API is currently in beta. To try it out, contact us for application.

©2013-2022 Tencent Cloud. All rights reserved.

Page 9 of 25

Cloud Infinite

Image Processing Practices
Downsizing Image with CI：

Last updated 2024-01-31 16:54:06

Overview
As your business grows, the used storage space and traffic of COS increase rapidly, especially for image services, themost critical part of the web. Due to the sync loading feature of HTML, an image is usually loaded only after theprevious image is fully loaded, yet lowering the resolution locally will lose most of the details in images. CI provides theextremely cost-effective image compression feature to greatly reduce the image size. This document takes HEIF as an
example.
For billing details, see Image Advanced Compression Fees.
The HEIF compression feature can convert images into the HEIF format. HEIF offers over 80% smaller file sizes at thesame quality compared with JPG and has the highest compression speed.
AVIF is a new compressed image format based on AV1, which can only be viewed in newer browsers.
Image compatibility is as follows:
FormatAndroid 12

iOS 15.4

Windows 11

Compression

PNG

✓

✓

✓

None

JPG

✓

✓

✓

None

AVIF

×

×

Extension required↓ 50+%HEIF✓✓

Extension required↓ 30+%TPG

QQ Browser only

QQ Browser only

QQ Browser only

↓ 50+%

WebP

✓

✓

✓

↓ 20+%

Prerequisites
You have logged in to the CI console and activated the CI service.
You have created and bound a storage bucket. For more information, see Configuring Buckets.
You have activated image advanced compression.

©2013-2022 Tencent Cloud. All rights reserved.

Page 10 of 25

Cloud Infinite

Directions
Processing existing data
Processing through job
1. Create a template as instructed in Image Processing.
The main parameters are as follows:
Resize Mode: Select No-scaling.
Output Format: Select AVIF or HEIF.
2. Create a job as instructed in Creating Image Processing Job.
Note:
The operations are tedious if you need to batch process data. In this case, we recommend you process data througha workflow.
Processing through workflow
1. Create a template as instructed in Image Processing.
The main parameters are as follows:
Resize Mode: Select No-scaling.
Output Format: Select AVIF or HEIF.
2. Create an image workflow as instructed in Creating Workflow.
The main parameters are as follows:
Input Bucket Name: Select the bound bucket.
Format Match: Select Image file.
Configure Workflow: Select Image processing.
3. On the workflow management page, find the newly created workflow and click Run Workflow.
4. Set the scanning mode to Run workflow for multiple files, configure other parameters as needed, and click Run
workflow. For detailed directions, see Triggering Workflow.

Processing uploaded data
Data workflow (recommended)
On the workflow management page, find the newly created workflow and set Run upon Upload to Enabled.
API method
Images are only processed in real time and cannot be stored as files through the API method. Therefore, you need tokeep adding parameters during image upload to have images automatically stored. For more information, see
Persistent Image Processing.
Here, you need to customize the rules parameter, which can be viewed in the image processing section of theworkflow details.

©2013-2022 Tencent Cloud. All rights reserved.

Page 11 of 25

Cloud Infinite

Summary
Image size comparison
The following is an example:
Original Image (MB)HEIF (MB)AVIF (MB)

7.91

3.2

1.8

18

13

3.2

30

14

6.9

As can be clearly seen, HEIF and AVIF greatly reduce the size of the original JPG or PNG image. If there are 100,000
10 MB images in a folder, AVIF can save more than 300 GB space, which reduces storage fees and traffic fees by 24
USD and 102 USD respectively every month in a STANDARD storage pack for regions in the Chinese mainland.

Strengths and shortcomings
Type

Advanced Compression

Traditional Compression

Speed

Fast processing in the cloud

Local processing subject to device conditions

Definition

Almost lossless

Lossy

Compression ratio

Very highGeneral

Cost

Low

Subject to device conditions

Compatibility

MediumVery highWe recommend you use the HEIF format on iOS and use WebP or AVIF format on Windows.

FAQs
What should I do if processing fails for large images?
Size limit:
The input image cannot be larger than 32 MB, with its width and height not exceeding 30,000 pixels respectively, andthe total number of pixels not exceeding 250 million.
The width and height of the output image cannot exceed 9,999 pixels respectively.
For an animated input image, the total number of pixels (width * height * number of frames) cannot exceed 250 million.

©2013-2022 Tencent Cloud. All rights reserved.

Page 12 of 25

Cloud Infinite

If the above limits are exceeded, processing will fail. We recommend you use Photoshop or other software tools to
reduce the image size before processing.

What should I do if processing cannot start?
Check whether you have activated the CI service and enabled the image advanced compression feature and whether
your account balance is sufficient.

What should I do if processing takes too long?
Generally speaking, it takes 10 minutes to process an image. If processing takes a longer time, restart the job. If the
problem persists, check whether the image content is too complex and optimize it if so.
If the problem persists, submit a ticket for assistance.

©2013-2022 Tencent Cloud. All rights reserved.

Page 13 of 25

Cloud Infinite

Hybrid Watermarking：

Last updated 2024-01-31 16:54:06

Overview
The basic image processing feature of CI enables you to add an image or text watermark to images. However, in
actual business scenarios, an image may contain both a fixed logo watermark and a dynamically changing text
watermark (username). For such scenarios, the following integration methods are provided. You can select anappropriate one based on your actual business scenario.

Method Comparison
Method

Pros

Cons

1

It is easy to integrate and implement.

The watermark size cannot change dynamically with theimage size or tiled.

2

It can better fit the image when theimage size changes frequently.

It is difficult to integrate and is charged processing fees
twice.

How to Use
Method 1. Using a pipeline operator to add two types of watermarks with only one URL
The basic image processing feature of CI allows you to use pipeline operators "|" to process an image multiple times
with only one request at a one-time charge of processing and traffic fees. This method greatly reduces the latency andadditional fees caused by repeated requests.
Directions
1. Define the image watermark parameters as instructed in Image Watermarking.
If you are unfamiliar with API parameters, you can add a style in the console to generate parameters as instructed in
Basic Processing.
Below are the processing parameters:©2013-2022 Tencent Cloud. All rights reserved.

Page 14 of 25

Cloud Infinite

watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTgxMjU2MzguY29zLmFwLWd1YW5nemhvdS5teXFjb
Note:
Here,
aHR0cDovL2V4YW1wbGVzLTEyNTgxMjU2MzguY29zLmFwLWd1YW5nemhvdS5teXFjbG91ZC5jb20vbG9nby5
wbmc is the URL-safe Base64-encoded URL of the image watermark (image stored in the COS bucket).
2. Define the text watermark parameters as instructed in Text Watermarking.
If you are unfamiliar with API parameters, you can add a style in the console to generate parameters as instructed in
Basic Processing.

©2013-2022 Tencent Cloud. All rights reserved.

Page 15 of 25

Cloud Infinite

watermark/2/text/VUlOOiAxMjM0NTY3OA/font/SGVsdmV0aWNhLmRmb250/fontsize/36/fill/IzAw
Note:
Here, VUlOOiAxMjM0NTY3OA is the URL-safe Base64-encoded text of UIN: 12345678 .
3. Use a pipeline operator to concatenate image and text watermark parameters:©2013-2022 Tencent Cloud. All rights reserved.

Page 16 of 25

Cloud Infinite

watermark/2/text/VUlOOiAxMjM0NTY3OA/font/SGVsdmV0aWNhLmRmb250/fontsize/36/fill/IzAw
4. Add the concatenated parameters at the end of the image download URL:

©2013-2022 Tencent Cloud. All rights reserved.

Page 17 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/preview.png?watermark/2/t
To shorten the URL, you can add the part of the image watermark (unchanged) as the watermark1 style in the
console as instructed in Basic Processing.
In this way, the URL can be shortened to:©2013-2022 Tencent Cloud. All rights reserved.

Page 18 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/preview.png/watermark1?wa
If you need to change the text content later, you only need to replace VUlOOiAxMjM0NTY3OA in the URL with theupdated Base64 code; for example, UIN: 88888888 is encoded into VUlOOiA4ODg4ODg4OA , so you only
need to change the URL to the following content to replace the text:©2013-2022 Tencent Cloud. All rights reserved.

Page 19 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/preview.png/watermark1?wa

Method 2. Printing the text and image watermarks onto a transparent image and using theoutput image as the final image watermark
1. Upload a 400x400 px transparent PNG image to the bucket as instructed in File Management.
For example: https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/transparent.png
2. Generate and concatenate image and text watermark parameters as instructed in steps 1–3 of method 1.
3. Add the concatenated parameters at the end of the download URL of the transparent PNG image:©2013-2022 Tencent Cloud. All rights reserved.

Page 20 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/transparent.png?watermark
4. Use the transparent image as the image watermark and add the watermark to the original image:©2013-2022 Tencent Cloud. All rights reserved.

Page 21 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/preview.png?watermark/1/i
You can also use the scatype parameter to scale the image watermark proportionally to the image size and use
the batch parameter to tile the image watermark.

©2013-2022 Tencent Cloud. All rights reserved.

Page 22 of 25

Cloud Infinite

https://examples-1258125638.cos.ap-guangzhou.myqcloud.com/preview.png?watermark/1/i©2013-2022 Tencent Cloud. All rights reserved.

Page 23 of 25

Cloud Infinite

Workflow Practices
Using Custom Function to Manage COS Files：

Last updated 2024-01-31 16:54:06

Overview
COS workflow provides a series of processing capabilities for media files such as audios, videos, and images. You
can flexibly and quickly create a media processing workflow as needed. To satisfy your needs for customization andguarantee the flexibility, COS workflow offers the custom function feature for you to implement custom logic in SCF by
configuring function nodes in a workflow.
To make this feature easier to use, COS workflow provides common function feature templates and integrates theircreation to node configuration steps, facilitating subsequent processing of source and output files. Currently,
supported basic operations include modifying object attributes, moving objects, and deleting objects.

Use Cases
You want to move or transition source files after media processing to reduce the storage costs.
You want to tag output files or modify their headers after media processing to facilitate subsequent business use.

Solution Strengths
Out-of-the-box service: You can use the service after simple configuration, with no need to develop the function logic
or care about the complex deployment process.
Flexible configuration: You can configure nodes of common features as needed to perform different business
operations on source and output files.
Easy extension: You can modify the function logic to meet more customization requirements.

Directions
1. Log in to the COS console.
2. Click Bucket List on the left sidebar.
3. Click the target bucket to enter the bucket details page.
4. On the left sidebar, select Data Processing Workflow > Workflow Management and click Create Workflow.

©2013-2022 Tencent Cloud. All rights reserved.

Page 24 of 25

Cloud Infinite

5. On the workflow creation page, configure the media processing node required by the business such as
Audio/Video Transcoding. For more information, see Workflow.
6. On the workflow creation page, add the Custom Function node and select a required common feature function.
If you haven't created a function of this type, click Create.
Create a common feature function as follows:
6.1 Enter the basic function configuration: Enter the function name prefix, select Authorize SCF Service, and click
Next.
6.2 Configure attributes: Set the storage class and custom header based on the business needs and click Next.
6.3 Select the object to be processed. You can perform this operation only on the workflow source file.
6.4 Click OK.
6.5 COS workflow encapsulates processes such as function creation, version release, and alias-based stream switch.
Wait for the workflow to be created.
6.6 After the creation, select the function instance just created and click OK.
6.7 Click Save.

Operation Verification
1. Log in to the COS console.
2. Click Bucket List on the left sidebar.
3. Click the target bucket to enter the bucket details page.
4. On the left sidebar, select Data Processing Workflow > Workflow to enter the workflow management page.
5. Enable the workflow just created, go to the specified bucket, upload a media file, and wait for the workflow to be
executed.
6. After the workflow execution is completed:
You can see that media processing succeeded, and the output file was generated.
The storage class and custom header have been set for the source file.

©2013-2022 Tencent Cloud. All rights reserved.

Page 25 of 25