All Products
Search
Document Center

Object Storage Service:Get started with IMM

Last Updated:Dec 26, 2024

Intelligent Media Management (IMM) capabilities are integrated into Object Storage Service (OSS), allowing you to utilize various data processing and analysis features of IMM within OSS. This topic describes how to use OSS to access IMM features.

Prerequisites

  • IMM-related features are available only in regions where IMM is supported. For more information, see service registration.

  • IMM is activated. For more information, see activate product.

  • If you want to use IMM-related features as a Resource Access Management (RAM) user, make sure that the RAM user has the permissions described below.

    • System permissions: AliyunOSSFullAccess permission to access OSS and AliyunIMMFullAccess permission to access IMM. For information about how to grant permissions to RAM users, see grant permissions to a RAM user.

    • Custom permissions: oss:ProcessImm and ram:GetRole permissions. You need to create corresponding custom policies before granting permissions to a RAM user. For more information, see grant custom policy to a RAM user.

Billing

You are charged for using IMM. For more information, see billing overview.

Step 1: Map an IMM Project to your bucket

  1. Log on to the OSS Management Console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket.

  3. In the left-side navigation pane, select Data Processing.

  4. Click Document Processing or Media Processing, and then in the pop-up binding page, click the Map Project to Bucket button.

    Note

    You do not need to map an IMM project to your bucket for image processing.

  5. Select the method to map an IMM project in the IMM Configuration section of the Map Project dialog box.

    • Create Project: Enter the name of the project. The system will automatically create the corresponding IMM project in the region where the bucket is located and map the project to the current bucket.

      image..png

    • Map Existing Project: Select the IMM project that you want to map to the bucket from the drop-down list.

      image..png

      Important

      The option map an existing project is available only if the corresponding IMM project is created in the region where the bucket is located. For more information, see create project.

  6. Click OK.

Step 2: Use IMM

Use IMM in the OSS console

  1. Click Buckets. On the Buckets page, click the name of the bucket.

  2. In the left-side navigation pane, select Data Processing.

  3. Click menus such as Document Processing and Media Processing to use IMM features (such as creating styles and tasks).

    image

Use OSS SDK for Intelligent Media Processing

The following sample code provides an example of how to trigger IMM by using x-oss-process.

# -*- coding: utf-8 -*-
import os
import oss2

# Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
endpoint = 'https://oss-cn-hangzhou.aliyuncs.com'
# Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account, for the account has permissions on all API operations. We recommend that you use the AccessKey pair of a RAM user for API operations and O&M. To create a RAM user, log on to the RAM console.
access_key_id = 'yourAccessKeyId'
access_key_secret = 'yourAccessKeySecret'
# Specify the name of the bucket in which files are located.
bucket_name = 'examplebucket'
# Specify the full path of the object. Do not include the bucket name in the full path.
key = 'exampledir/example.docx'

# Specify the bucket instance. You must use the bucket instance to call all object-related methods.
bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name)

style = 'doc/preview,copy_1,export_1,print_1,pages_3'
# Generate a signed object URL that includes IMG parameters. Set the validity period of the URL to 600 seconds.
url = bucket.sign_url('GET', key, 10 * 60, params={'x-oss-process': style})
print(url)