Meitu Design Studio: AI Commercial Photography Web SDK
Description
The Meitu Design Studio AI Commercial Photography SDK integrates AI Model, AI Virtual Try-On, and Clothing Recoloring features. It supports online virtual try-on, clothing color replacement, and intelligent model generation, enabling efficient, intelligent photography for e-commerce and design scenarios.
Demo
https://public.static.meitudata.com/xiuxiu-pc/image-editor-sdk/3.0.0/demo/aicp.html
SDK Overview
Version
3.6.3
Supported Browsers
Chrome and other modern browsers
Supported Integration Methods
- Enterprise-level in-depth partnership integration (unified account authorization and login)
- Standard integration (not yet available)
Prerequisites
Obtain an Access Key
- Visit the Meitu AI Open Platform to log in and register an account.
- Go to the Access Keys management page.
- Click the “Create Key” button to generate and obtain your Access Key.
The Access Key is the core credential for SDK authentication. Keep it secure and avoid disclosure.
Silent Login Configuration
- Enable the Inpainting Web SDK feature.
- On the “Overview” page, go to the service list and click “Silent Login Authorization”.
- In Application Whitelist Address, enter the domain of the website where you plan to embed the SDK.
- In Application Silent Login Address, configure your silent login callback URL.
For integration instructions, refer to: Meitu Products (Web) Silent Login Integration Guide
Quick Start
Include the SDK
The SDK provides two integration methods: installation via NPM or inclusion via CDN. Choose the appropriate method for your project environment.
Method 1: Install via NPM
# Install the SDK
npm i mt-image-editor-sdk// Import the SDK module
import MTImageEditor, { MTImageEditorClass } from 'mt-image-editor-sdk';
// Multi-instance mode is supported starting from version 3.0.0
// Initialization is the same as in singleton mode
const MTEditor1 = new MTImageEditorClass();
MTEditor1.init({...});Method 2: Include via CDN
<script src="https://public.static.meitudata.com/xiuxiu-pc/image-editor-sdk/3.0.0/dist/index.min.js"></script>Initialization and Usage
It is recommended to initialize the SDK immediately after the page finishes loading to improve the speed of the first launch.
MTImageEditor.init({
// Required: Authentication key obtained from the Meitu Open Platform
accessKey: 'your_access_key',
// Silent login key
appKey: 'your_app_key',
// Required: Specify the module to integrate
moduleName: 'ai-commercial-photography-sdk',
// Required when silent login is enabled; refer to the login documentation below
// https://titan-h5.meitu.com/xiuxiu-pc/design-open/doc/美图产品(web)静默登录接入文档v0.1.pdf
code: '',
// Optional: SDK title
title: 'Meitu Design Studio — AI Commercial Photography',
// Optional: Mount node; if omitted, the SDK is displayed as a popup
el: '',
// Optional: Whether to enable the fullscreen feature
fullscreen: true,
// Optional: Whether to automatically resize on window.onresize
resizeAble: true,
// Additional business parameters (optional)
extraInfo: {
/**
* [Optional parameter] Used for model try-on to specify the subfeatures to display.
* If omitted or empty, all features will be displayed.
* @type {Array<'model' | 'clothes' | 'wig'>}
* - model: Model image
* - clothes: Clothing image
* - wig: Wig image
*/
modelFunctionSet: ['model'],
/**
* [Optional parameter] The business module to open by default.
* If omitted, the purchased feature module will open by default.
* @type {'product' | 'portrait' | 'model' | 'clothes' | 'wig' | 'recolor'}
*/
redirect: 'product',
/**
* [Optional parameter] The set of features to display.
* If omitted or empty, all features will be displayed.
* @type {Array<'product' | 'portrait' | 'model' | 'clothes' | 'wig' | 'recolor'>}
*/
functionSet: ['product', 'portrait'],
/**
* [Optional parameter] Whether to prevent the default download event.
* 0: Allow downloads; 1: Prevent downloads.
*/
downloadPreventDefault: 1,
/**
* [Optional parameter] Custom text for the download button.
*/
customDownloadText: 'Custom',
/**
* [Optional parameter] Callback for a failure to open an image.
*/
onError: (data) => console.log('Failed to open image', data),
},
});
SDK Methods
Open an Image
// Open the specified image by clicking a button
// Additional business parameters can be passed to specify the module to open. If omitted, the business parameters configured during SDK initialization will be used
// redirect: Has the same meaning as the redirect business parameter configured during SDK initialization
MTImageEditor.openImage(URL, {
redirect?: 'product' | 'model' | 'clothes' | 'wig' | 'recolor'
});Support for Passing Multiple Images
MTImageEditor.openImage([
'https://xiuxiu-pro-pre.meitudata.com/ai_product/58494ab25ef237f9822a3bd1774b4ae3.jpeg',
'https://xiuxiu-pro.meitudata.com/ai_material/static/13-ui.png',
'https://xiuxiu-pro.meitudata.com/ai_material/static/33-ui.png',
'https://xiuxiu-pro.meitudata.com/ai_material/static/4-ui.png',
]);Events and Callbacks
Save an Image
MTImageEditor.saveImage((base64, type) => {
console.log('Image type:', type); // jpg | png
console.log('Image data:', base64);
});
Listen for AIGC Task Status
// AIGC task started
MTImageEditor.onAigcStart(({ taskId }) => {
console.log('AI generation task started, taskId:', taskId);
});
// AIGC task completed
MTImageEditor.onAigcFinish(({ taskId, urls }) => {
console.log('AI generation completed:', urls);
// urls contains the Meitu CDN URLs of the resulting images; saving your own copies is recommended
});
Popup Controls
MTImageEditor.openImage(); // Open the popup
MTImageEditor.close(); // Close the popup
MTImageEditor.onClose(() => {
console.log('Popup closed');
});
Feature Descriptions
| Feature | Method | Description |
|---|---|---|
| Initialize SDK | MTImageEditor.init() | Initialize the editor instance |
| Open image | MTImageEditor.openImage() | Open one or multiple images for editing |
| Save image | MTImageEditor.saveImage() | Retrieve the generated image data |
| Listen for generation | onAigcStart / onAigcFinish | Listen for AI task status |
| Control popup | openImage / close | Open or close the editor popup |
| Close callback | onClose | Listen for the close event |
Parameter Descriptions
| Required | Parameter | Type | Description |
|---|---|---|---|
| Required | accessKey | String | Authentication key obtained from the Meitu Open Platform, used to validate SDK requests. |
| Required | appKey | String | Unique application identifier, corresponding to the application appid for silent login on the Open Platform. |
| Required | accessKey | String | Authentication key obtained from the Meitu Open Platform, used to validate SDK requests. |
| Required | moduleName | String | Specifies the name of the service module to integrate. Currently supported: ai-commercial-photography-sdk (AI Commercial Photography). |
| Optional | code | String | If Meitu silent login is enabled, provide the authorization code returned by silent login. For how to generate code, refer to the Meitu Products (Web) Silent Login Integration Guide |
| Optional | title | String | Editor window title. Defaults to “Meitu Design Studio - AI Commercial Photography”. |
| Optional | el | String | Selector for the DOM container where the SDK is mounted. If omitted, the SDK is displayed as a popup. |
| Optional | fullscreen | Boolean | Whether to enable fullscreen mode. Defaults to true. |
| Optional | resizeAble | Boolean | Whether to automatically resize when the browser window size changes. Defaults to true. |
| Optional | extraInfo | Object | Additional business configuration options. See the extraInfo parameter descriptions below. |
extraInfo Parameter Descriptions
| Required | Parameter | Type | Description |
|---|---|---|---|
| Optional | modelFunctionSet | Array | The set of subfeatures used for model try-on. If omitted or empty, all features will be displayed. ⚠️ This property will be deprecated in the future. Use functionSet instead. |
| Optional | redirect | String | The module page to open by default. If omitted, the purchased module will be opened automatically. Examples: 'product' (product images), 'recolor' (recoloring), etc. |
| Optional | functionSet | Array | The set of features to display. If omitted or empty, all features will be displayed. Example of commonly used values: ['product', 'portrait']. |
| Optional | downloadPreventDefault | Number | Whether to prevent the download button’s default event.0: Allow downloads; 1: Prevent downloads. |
| Optional | customDownloadText | String | Custom text for the download button. For example: "Download Now". |
| Optional | onError | - | Callback function triggered when an image fails to open. The data parameter is an error information object. |
Frequently Asked Questions
| Issue | Possible Cause | Solution |
|---|---|---|
| “403” error during initialization | Domain not authorized or key mismatch | Check the whitelist configuration and accessKey |
| The page cannot load the editor | SDK URL or network issue | Check whether the CDN URL is correct |
| Login verification failed | code has expired | Request a new silent login credential |
Notes
- Risk notice: Data in [Generation History] and [My Images] is isolated by uid. It is recommended that each user access and use the SDK with a different id.
Versions
| Date | Version | Description |
|---|---|---|
| 2025-12-20 | 3.6.3 | Switched the domain from .com to .cn |
| 2025-11-11 | 3.6.2 | SDK supports silent login |
| 2025-07-16 | 3.6.0 | SDK supports multiple instances |
| 2024-09-26 | 3.4.0 | openImage supports passing multiple images |
| 2024-08-07 | 3.3.5 | Added custom download text, download prevention, and an openImage error callback for commercial photography |
| 2024-06-13 | 3.2.0 | Changed the Meitu Design Studio domain to: www.designkit.com |
| 2024-06-03 | 3.1.0 | Supports callbacks for the start and completion of AIGC generation |
| 2024-04-16 | 2.4.3 | Unified the commercial photography SDK and added support for business parameters |
| 2023-05-30 | 2.0.2 | Added domain whitelist support |
Contact
For technical issues or integration inquiries, please contact Meitu Open Platform technical support: Meitu AI Open Platform