接口说明
更新时间:2025-11-04
图像无损放大
输入一张图片,可以在尽量保持图像质量的条件下,将图像在长宽方向各放大两倍。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 // 参数为本地路径
6 String image = "test.jpg";
7 JSONObject res = client.imageQualityEnhance(image, options);
8 System.out.println(res.toString(2));
9
10 // 参数为二进制数组
11 byte[] file = readFile("test.jpg");
12 res = client.imageQualityEnhance(file, options);
13 System.out.println(res.toString(2));
14}
图像无损放大 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据,大小不超过4M,长宽乘积不超过1600p x 1600px。 |
图像无损放大 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
图像无损放大 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
图像去雾
对浓雾天气下拍摄,导致细节无法辨认的图像进行去雾处理,还原更清晰真实的图像。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 // 参数为本地路径
6 String image = "test.jpg";
7 JSONObject res = client.dehaze(image, options);
8 System.out.println(res.toString(2));
9
10 // 参数为二进制数组
11 byte[] file = readFile("test.jpg");
12 res = client.dehaze(file, options);
13 System.out.println(res.toString(2));
14}
图像去雾 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据 |
图像去雾 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
图像去雾 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
图像对比度增强
调整过暗或者过亮图像的对比度,使图像更加鲜明。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 // 参数为本地路径
6 String image = "test.jpg";
7 JSONObject res = client.contrastEnhance(image, options);
8 System.out.println(res.toString(2));
9
10 // 参数为二进制数组
11 byte[] file = readFile("test.jpg");
12 res = client.contrastEnhance(file, options);
13 System.out.println(res.toString(2));
14}
图像对比度增强 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据 |
图像对比度增强 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
图像对比度增强 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
黑白图像上色
智能识别黑白图像内容并填充色彩,使黑白图像变得鲜活。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5
6 // 参数为本地路径
7 String image = "test.jpg";
8 JSONObject res = client.colourize(image, options);
9 System.out.println(res.toString(2));
10
11 // 参数为二进制数组
12 byte[] file = readFile("test.jpg");
13 res = client.colourize(file, options);
14 System.out.println(res.toString(2));
15}
黑白图像上色 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据,大小不超过4M,最短边至少64px,最长边最大800px,长宽比3:1以内。 |
黑白图像上色 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
黑白图像上色 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
拉伸图像恢复
自动识别过度拉伸的图像,将图像内容恢复成正常比例。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5
6 // 参数为本地路径
7 String image = "test.jpg";
8 JSONObject res = client.stretchRestore(image, options);
9 System.out.println(res.toString(2));
10
11 // 参数为二进制数组
12 byte[] file = readFile("test.jpg");
13 res = client.stretchRestore(file, options);
14 System.out.println(res.toString(2));
15}
拉伸图像恢复 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据 |
拉伸图像恢复 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
拉伸图像恢复 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
图像风格转换
可将图像转化成卡通画、铅笔画、彩色铅笔画,或者哥特油画、彩色糖块油画、呐喊油画、神奈川冲浪里油画、奇异油画、薰衣草油画等共计9种风格,可用于开展趣味活动,或集成到美图应用中对图像进行风格转换。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 """ 如果有可选参数 """
6 options.put("option", "cartoon");
7
8 // 参数为本地路径
9 String image = "test.jpg";
10 JSONObject res = client.styleTrans(image, options);
11 System.out.println(res.toString(2));
12
13 // 参数为二进制数组
14 byte[] file = readFile("test.jpg");
15 res = client.styleTrans(file, options);
16 System.out.println(res.toString(2));
17}
图像风格转换 请求参数详情
| 参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
|---|---|---|---|---|
| image | true | string | - | base64编码后大小不超过4M,像素乘积不超过2000*2000,最短边至少50px,最长边最大4096px,长宽比3:1以内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,) |
| option | true | string | cartoon pencil color_pencil warm wave lavender mononoke scream gothic |
cartoon:卡通画风格 pencil:铅笔风格 color_pencil:彩色铅笔画风格 warm:彩色糖块油画风格 wave:神奈川冲浪里油画风格 lavender:薰衣草油画风格 mononoke:奇异油画风格 scream:呐喊油画风格 gothic:哥特油画风格 |
图像风格转换 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
图像风格转换 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
人物动漫化
运用世界领先的对抗生成网络,结合人脸检测、头发分割、人像分割等技术,为用户量身定制千人千面的二次元动漫形象,并且可通过参数设置,生成戴口罩的二次元动漫人像。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 """ 如果有可选参数 """
6 options.put("type", "anime");
7 options.put("mask_id", 3);
8
9 // 参数为本地路径
10 String image = "test.jpg";
11 JSONObject res = client.selfieAnime(image, options);
12 System.out.println(res.toString(2));
13
14 // 参数为二进制数组
15 byte[] file = readFile("test.jpg");
16 res = client.selfieAnime(file, options);
17 System.out.println(res.toString(2));
18}
人物动漫化 请求参数详情
| 参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
|---|---|---|---|---|
| image | true | string | - | 需要处理的图片base64编码后大小不超过4M,最短边至少64px,最长边最大4096px,长宽比3:1以内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,) |
| type | false | string | - | anime或者anime_mask。前者生成二次元动漫图,后者生成戴口罩的二次元动漫人像 |
| mask_id | false | int | 1-8 | 在type参数填入anime_mask时生效,1~8之间的整数,用于指定所使用的口罩的编码。type参数没有填入anime_mask,或mask_id 为空时,生成不戴口罩的二次元动漫图。 |
人物动漫化 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | 处理后图片的Base64编码 |
人物动漫化 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":base64str
4}
图像清晰度增强
对压缩后的模糊图像实现智能快速去噪,优化图像纹理细节,使画面更加自然清晰。
Java
1public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4
5 // 参数为本地路径
6 String image = "test.jpg";
7 JSONObject res = client.imageDefinitionEnhance(image, options);
8 System.out.println(res.toString(2));
9
10 // 参数为二进制数组
11 byte[] file = readFile("test.jpg");
12 res = client.imageDefinitionEnhance(file, options);
13 System.out.println(res.toString(2));
14}
图像清晰度增强 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| image | 是 | string | 需要处理的图片base64编码后大小不超过4M,最短边至少64px,最长边最大4096px,长宽比3:1以内,像素乘积不超过 1280*720。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,) |
图像清晰度增强 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 否 | string | base64编码图片 |
图像清晰度增强 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
图像修复
去除图片中不需要的遮挡物,并用背景内容填充,提高图像质量。
Java
1 public void sample(AipImageProcess client) {
2 // 传入可选参数调用接口
3 HashMap<String, String> options = new HashMap<String, String>();
4 // [{'width': 92, 'top': 25, 'height': 36, 'left': 543}]
5 JSONObject jsonObject = new JSONObject();
6 jsonObject.put("width",1);
7 jsonObject.put("top",1);
8 jsonObject.put("height",1);
9 jsonObject.put("left",1);
10 List<JSONObject> rectangle = new ArrayList<JSONObject>();
11 rectangle.add(jsonObject);
12 // 参数为本地路径
13 String image = "test.jpg";
14 JSONObject res = client.inpaintingByMask(image, rectangle, options);
15 System.out.println(res.toString(2));
16
17 // 参数为二进制数组
18 byte[] file = readFile("test.jpg");
19 res = client.inpaintingByMask(file, rectangle, options);
20 System.out.println(res.toString(2));
21}
图像修复 请求参数详情
| 参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
|---|---|---|---|---|
| rectangle | true | array[] | [{'width': 92, 'top': 25, 'height': 36, 'left': 543}] | 要去除的位置为规则矩形时,给出坐标信息,每个元素包含left, top, width, height,int 类型。 |
| image | true | string | - | 被修复的图片base64编码后大小不超过4M,最短边至少100px,最长边最大2000px,长宽比3:1内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,) |
图像修复 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 |
|---|---|---|---|
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
| image | 是 | string | 修复后的base64编码图片 |
图像修复 返回示例
JSON
1{
2 "log_id":739539874,
3 "image":"base64str"
4}
评价此篇文章
