{
    "openapi": "3.0.0",
    "info": {
        "title": "图片翻译 - API文档",
        "version": "1.0.0",
        "description": "支持10数种主流文字语言互译，可自动识别图片中的文本内容并翻译成目标语言。支持的语种请查看：<a href=\"https:\/\/www.tianapi.com\/article\/51\" target=\"_blank\">语言代码表<\/a>。图片参数请传base64，可用<a href=\"\/demo\/base64\" target=\"_blank\">图片\/base64互转<\/a>工具测试。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/imgfanyi\/index": {
            "post": {
                "summary": "图片翻译",
                "tags": [
                    "图片翻译"
                ],
                "description": "OCR识别并自动逐行翻译图片内容",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "string",
                                        "example": "en",
                                        "description": "目标语言代码"
                                    },
                                    "img": {
                                        "type": "string",
                                        "example": "base64",
                                        "description": "图片base64编码"
                                    },
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    }
                                },
                                "required": [
                                    "to",
                                    "img",
                                    "key"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "to": {
                                            "type": "string",
                                            "example": "zh",
                                            "description": "目标语言"
                                        },
                                        "from": {
                                            "type": "string",
                                            "example": "en",
                                            "description": "来源语言"
                                        },
                                        "x_coord": {
                                            "type": "int",
                                            "example": 153,
                                            "description": "X坐标"
                                        },
                                        "y_coord": {
                                            "type": "int",
                                            "example": 261,
                                            "description": "Y坐标"
                                        },
                                        "source_text": {
                                            "type": "string",
                                            "example": "Welcome to TianAPI",
                                            "description": "源文"
                                        },
                                        "target_text": {
                                            "type": "string",
                                            "example": "欢迎使用天行数据",
                                            "description": "译文"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "to": "zh",
                                        "from": "en",
                                        "list": [
                                            {
                                                "x_coord": 146,
                                                "y_coord": 224,
                                                "source_text": "Welcome to TianAPI",
                                                "target_Text": "欢迎使用天行数据"
                                            },
                                            {
                                                "x_coord": 150,
                                                "y_coord": 285,
                                                "source_text": "Image translation API",
                                                "target_text": "图片翻译API"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}