{
  "openapi": "3.0.3",
  "info": {
    "title": "盲水印",
    "description": "通过上传原始图片和水印图,生成带有隐性水印图的图片。主要应用于音像作品、数字图书等场景，目的是在不破坏原始作品的情况下，实现版权的防护与追踪。",
    "termsOfService": "https://www.showapi.com/helpcenter/view#/4019/2",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://route.showapi.com"
    }
  ],
  "paths": {
    "/2108-2": {
      "x-pointCode": 2,
      "x-mode": "mapping",
      "x-read-timeout": 60,
      "x-connect-timeout": 60,
      "post": {
        "summary": "获取水印（Base64方式）",
        "description": "获取水印（Base64方式）的接口适用于图片编辑、版权保护、社交媒体分享等场景。",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "result_img": {
                              "type": "string",
                              "description": "分析出来的水印图片,水印添加在图片的左上角和右下角,由于水印文件做过旋转\\缩放\\傅里叶等变换,所以解析出来的水印文件和原始水印文件会有区别,但也能通过水印文件区分版权信息"
                            },
                            "src_img": {
                              "type": "string",
                              "description": "上传的原始图片"
                            },
                            "msg": {
                              "type": "string",
                              "description": "操作的结果说明"
                            },
                            "ret_code": {
                              "type": "string",
                              "description": "0表示操作成功并扣减调用次数, 其他值表示失败"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "2108_2_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "src_img_base64": {
                    "type": "string",
                    "minLength": 0,
                    "maxLength": 10000000,
                    "description": "具有盲水印的图片，仅支持JPEG, PNG!该图片为\"万维易源\"<盲水印>接口生成的水印图片"
                  },
                  "r1": {
                    "type": "string",
                    "description": "随机因子1\n"
                  },
                  "r2": {
                    "type": "string",
                    "description": "随机因子2"
                  }
                },
                "required": [
                  "src_img_base64"
                ]
              }
            }
          }
        }
      }
    },
    "/2108-1": {
      "x-pointCode": 1,
      "x-mode": "mapping",
      "x-read-timeout": 60,
      "x-connect-timeout": 60,
      "post": {
        "summary": "添加水印（Base64方式）",
        "description": "图片尽量选择正方形的，适用于图片处理、版权保护、社交媒体分享等场景。",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "src_img": {
                              "type": "string",
                              "description": "原始图片(未加水印的图片)"
                            },
                            "sy_img": {
                              "type": "string",
                              "description": "水印图片,水印会根据原始图片大小和水印的大小之间的比例来进行缩放\\翻转\\傅里叶变换等操作,最终合并成一个左上和右下对称的水印文件,并把该水印文件添加到src_img图片中."
                            },
                            "result_img": {
                              "type": "string",
                              "description": "添加了水印后的图片"
                            },
                            "ret_code": {
                              "type": "string",
                              "description": "0表示操作是否成功并扣费 其他值为失败"
                            },
                            "r1": {
                              "type": "string",
                              "description": "随机因子1（主要保存好，每个图片唯一，解析水印时需要）"
                            },
                            "r2": {
                              "type": "string",
                              "description": "随机因子2（主要保存好，每个图片唯一，解析水印时需要）"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "2108_1_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "sy_img_base64": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000000,
                    "description": "水印文件的base64编码，文件大小不能超过5M，仅支持JPEG, PNG!\n\n\n注：只能嵌入二值化的信息, 会自动取水印的B通道并二值化嵌入,水印最好是黑白的图片\n要求水印的长×宽 <= 图片的长/4 × 图片的宽/4 , 程序会自动验证"
                  },
                  "src_img_base64": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000000,
                    "description": "需要处理的原图片的base64编码，文件大小不能超过5M，仅支持JPEG, PNG!"
                  }
                },
                "required": [
                  "sy_img_base64",
                  "src_img_base64"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AppKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "appKey",
        "description": "从 ShowAPI 控制台获取的 appKey，管理地址：https://www.showapi.com/console#/myApp"
      }
    },
    "schemas": {
      "ShowapiResEnvelope": {
        "type": "object",
        "description": "ShowAPI 统一返回包裹（业务数据位于 showapi_res_body）",
        "properties": {
          "showapi_res_code": {
            "type": "integer",
            "description": "API 返回的状态码"
          },
          "showapi_res_error": {
            "type": "string",
            "description": "API 返回的错误信息"
          },
          "showapi_res_id": {
            "type": "string",
            "description": "API 请求的唯一标识"
          },
          "showapi_fee_num": {
            "type": "integer",
            "description": "API 调用计费次数"
          }
        }
      }
    }
  },
  "security": [
    {
      "AppKeyAuth": []
    }
  ],
  "externalDocs": {
    "url": "https://www.showapi.com/apiGateway/view/2108?tab=book"
  },
  "x-apiCode": "2108",
  "x-is-own": true,
  "x-is-op": true
}