tencent cloud

Feedback

Real-Time Image Processing

Last updated: 2022-05-27 10:53:50

    Overview

    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.

    Directions

    Step 1. Upload images

    1. Log in to the VOD console and select Application Management on the left sidebar.
    2. Find the target application and click its name.
    3. By default, you will enter the **Media Assets > Video Management > Uploaded ** page.
    4. Select Image Management on the left sidebar and click Upload Image.

    Step 2. Create a template

    You can create a real-time image processing template by calling a VOD API.

    1. 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>
      
    2. The template ID returned by the API is 1009.

      {
      "Response":{
      "Definition": 1009,
      "RequestId": "12ae8d8e-dce3-4151-9d4b-5594145287e1"
      }
      }
      

    Step 3. Learn about URL-based image processing

    VOD processes images based on URLs.

    URL of the processed image = URL of the original image + Separator + Image template ID + “.” + Output image format

    • URL of the original image: The accelerated URL generated after an image is uploaded to VOD.
    • Separator: !
    • Output image format: JPG, JPEG, PNG

    Step 4. Learn about the processing types

    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

    Type 1. Scaling

    • 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:

    Type 2. Cropping

    • 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:

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support