Updated on 2024-08-09 GMT+08:00

Processing an Image by Editing Code

This case describes how to resize an image by editing code on OBS Console.

Procedure

  1. On the console homepage, click Service List in the upper left corner and choose Storage > Object Storage Service.
  2. In the bucket list, click the bucket you want to go to the Objects page.
  3. Click Upload Object to open the Upload Object dialog box.
  4. Click add files marked by red box in Figure 1 to open the local file browser.

    Figure 1 Uploading an image

  5. Select the image that you want to upload and click Open.
  6. Click Upload to upload the image. The uploaded image is displayed in the object list.
  7. In the navigation pane, choose Data Processing > Image Processing.
  8. Click Create to go to the style editing page
  9. Set Style Name to style002 and choose Code for Edit Mode.
  10. In the code input box, type the following command for resizing.

    Specify a rectangle whose width (indicated by w) and height (indicated by h) are both 100. Lock the aspect ratio, and obtain the smallest image in the extended area of the 100 x 100 rectangle.

    image/resize,m_mfit,h_100,w_100

    The style effect will be displayed on the right in real time. Figure 2 shows the final style effect.

    Figure 2 Effect of style style002

  11. Click OK to save the style. The new style style002 will be displayed in the style list.
  12. In the navigation pane, choose Objects. Click mountain.jpg in the object list to go to the file details page.
  13. Click the Preview Image tab to preview the effect of the image with style style002 applied. For details, see Figure 3.

    Figure 3 Preview Image

  14. In the image style card, click Copy Link. When Copied successfully. is prompted, you will have the address for accessing the image with the style applied.