This document shows you how to create a template in the VOD console to process images in real time. The processing is based on URLs, which allows quick image generation.
You can create a real-time image processing template by calling a VOD API.
For example, to create a template for 240 x 240 thumbnails, use the request URL below:
https://vod.tencentcloudapi.com/?Action=CreateImageProcessingTemplate
&Operations.0.Type=Scale
&Operations.0.Scale.Type=ShortEdgeFirst
&Operations.0.Scale.ShortEdge=240
&Operations.1.Type=CenterCut
&Operations.1.CenterCut.Type=Rectangle
&Operations.1.CenterCut.Width=240
&Operations.1.CenterCut.Height=240
&<Common request parameters>
The template ID returned by the API is 1009
.
{
"Response":{
"Definition": 1009,
"RequestId": "12ae8d8e-dce3-4151-9d4b-5594145287e1"
}
}
VOD processes images based on URLs.
There are two processing types: scaling and cropping.
Type | Operation |
---|---|
Scaling | Width: specified; height: auto-scaled |
Height: specified; width: auto-scaled | |
Long side: specified; short side: auto-scaled | |
Short side: specified; long side: auto-scaled | |
Width: specified; height: specified | |
Cropping | Cropping to circle, with the radius specified |
Cropping to rectangle, with height and width specified |
Width: specified; height: auto-scaled
Template ID: 13290; width: 700; output format: PNG.
The URL of the processed image is: https://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/0f9d472c387702299328320141/Cov1ATJ3AYYA.jpg!13290.PNG
Result:
Height: specified; width: auto-scaled
Template ID: 13291; height: 700; output format: PNG
The URL of the processed image is: http://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/0f9d472c387702299328320141/Cov1ATJ3AYYA.jpg!13291.PNG
Result:
Long side: specified; short side: auto-scaled
Template ID: 13292; long side: 300; output format: PNG
The URL of the processed image is: https://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/0f9d472c387702299328320141/Cov1ATJ3AYYA.jpg!13292.PNG
Result:
Short side: specified; long side: auto-scaled
Template ID: 13293; short side: 300; output format: PNG
The URL of the processed image is: https://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/0f9d472c387702299328320141/Cov1ATJ3AYYA.jpg!13293.PNG
Result:
Width: specified; height: specified
Template ID: 13294; height: 300; width: 300; output format: PNG
The URL of the processed image is: https://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/0f9d472c387702299328320141/Cov1ATJ3AYYA.jpg!13294.PNG
Result:
Cropping to circle
Template ID: 13295; radius: 300; output format: PNG
The URL of the processed image is: http://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/182b0f2a387702299461251102/EOy4fI1V8gQA.jpg!13295.PNG
Result:
Cropping to rectangle
Template ID: 13296; output height: 300; output width: 300; output format: PNG
The URL of the processed image is: http://1500012191.vod2.myqcloud.com/6caaa776vodcq1500012191/23c473bb387702299461744409/HVSbBfQq3JgA.jpg!13296.PNG
Result:
Was this page helpful?