- Print
- PDF
Image Translation (Image)
- Print
- PDF
Available in Classic and VPC
Recognize (OCR) text in images in JPG, JPEG, PNG, and TIFF formats and provide translated text and translated images.
Please note the following when using the API.
- Small image sizes may result in poor translation results. We recommend using images that are at least 1280 px on the long axis.
- Distorted image, cursive text, small sized text, and text with similar colors from the background may affect the quality of the image translation.
Request
The following describes the request format for the endpoint. The request format is as follows:
Method | URI |
---|---|
POST | /v1/translate |
Request headers
For headers common to all Papago Image Translation APIs, see Common Papago Image Translation headers.
Request body
The following describes the request body.
Field | Type | Required | Description |
---|---|---|---|
source | String | Required | Language code of the source text (source)
|
target | String | Required | Language code of the text to translate to (target)
|
image | JPG, JPEG, PNG, TIFF | Required | Original image file |
Even without specifying the source language (specified to auto
), it automatically detects the language and provides a translation result. In this case, additional fees do not incur for detecting languages but only for the number of characters requested for translation.
Request example
The following is a sample request.
curl --location --request POST 'https://naveropenapi.apigw.ntruss.com/image-to-image/v1/translate' \
--header 'X-NCP-APIGW-API-KEY-ID: {Client ID issued when registering the app}' \
--header 'X-NCP-APIGW-API-KEY: {Client secret issued when registering the app}' \
--header 'Content-Type;' \
--form 'source="auto"' \
--form 'target="ko"' \
--form 'image=@"{image}"'
Response
The following describes the response format.
Response body
The following describes the response body.
Field | Type | Required | Description |
---|---|---|---|
data | Object | - | Response result |
data.sourceLang | String | - | Source text language code |
data.targetLang | String | - | Translated text language code |
data.sourceText | String | - | Source text |
data.targetText | String | - | Translated text |
data.blocks | Array | - | Block-unit text recognition details |
data.LB | Object | - | Left bottom coordinate details |
data.LB.x | Integer | - | Left bottom coordinate x value |
data.LB.y | Integer | - | Left bottom coordinate y value |
data.LT | Object | - | Left top coordinate details |
data.LT.x | Integer | - | Left top coordinate x value |
data.LT.y | Integer | - | Left top coordinate y value |
data.RB | Object | - | Right bottom coordinate details |
data.RB.x | Integer | - | Right bottom coordinate x value |
data.RB.y | Integer | - | Right bottom coordinate y value |
data.RT | Object | - | Right top coordinate details |
data.RT.x | Integer | - | Right top coordinate x value |
data.RT.y | Integer | - | Right top coordinate y value |
data.renderedImage | String | - | Binary value of the translated image
|
blocks
The following describes blocks
.
Field | Type | Required | Description |
---|---|---|---|
sourceLang | String | - | Source text language code |
sourceText | String | - | Source text |
targetText | String | - | Translated text |
lines | Array | - | Line-unit text recognition details |
lines
The following describes lines
.
Field | Type | Required | Description |
---|---|---|---|
LB | Object | - | Left bottom coordinate details |
LB.x | Integer | - | Left bottom coordinate x value |
LB.y | Integer | - | Left bottom coordinate y value |
LT | Object | - | Left top coordinate details |
LT.x | Integer | - | Left top coordinate x value |
LT.y | Integer | - | Left top coordinate y value |
RB | Object | - | Right bottom coordinate details |
RB.x | Integer | - | Right bottom coordinate x value |
RB.y | Integer | - | Right bottom coordinate y value |
RT | Object | - | Right top coordinate details |
RT.x | Integer | - | Right top coordinate x value |
RT.y | Integer | - | Right top coordinate y value |
words | Array | - | Word-unit text recognition details |
words
The following describes words
.
Field | Type | Required | Description |
---|---|---|---|
sourceText | String | - | Source text |
LB | Object | - | Left bottom coordinate details |
LB.x | Integer | - | Left bottom coordinate x value |
LB.y | Integer | - | Left bottom coordinate y value |
LT | Object | - | Left top coordinate details |
LT.x | Integer | - | Left top coordinate x value |
LT.y | Integer | - | Left top coordinate y value |
RB | Object | - | Right bottom coordinate details |
RB.x | Integer | - | Right bottom coordinate x value |
RB.y | Integer | - | Right bottom coordinate y value |
RT | Object | - | Right top coordinate details |
RT.x | Integer | - | Right top coordinate x value |
RT.y | Integer | - | Right top coordinate y value |
Response status codes
For response status codes common to all Papago Image Translation APIs, see Common Papago Image Translation response status codes.
Response example
The following is a sample example.
{
"data": {
"sourceLang": "en",
"targetLang": "ko",
"sourceText": "U.S. Department of State Office of Language Services Translating Division\nEnglish=> Foreign Lang, Set 1\nGeneral Category (231 words)\nPlease translate everything below:\n",
"targetText": "U.S. Department of State, Language Services Translation Division\nEnglish => Foriegn language, set 1\nGeneral category (231 words)\nTranslate all of the following:\n",
"blocks": [
{
"sourceLang": "en",
"sourceText": "The two houses of Congress are much alike in their concern with local and special-interest legislation, their intricate legislative and parliamentary procedure, their tendency toward voting by blocks and interest groups in defiance of party ties. Yet the upper chamber has a character all its own.",
"targetText": "The two chambers have very similar concerns regarding local and special interest legislation, complex legislative and parliamentary procedures, and a tendency to vote by blocs and interest groups ignoring party affiliations. However, both upper chambers have their own unique characteristics.",
"lines": [
{
"LB": {
"x": 156,
"y": 238
},
"LT": {
"x": 156,
"y": 220
},
"RB": {
"x": 637,
"y": 238
},
"RT": {
"x": 637,
"y": 221
},
"words": [
{
"sourceText": "houses",
"LB": {
"x": 213,
"y": 235
},
"LT": {
"x": 213,
"y": 220
},
"RB": {
"x": 261,
"y": 235
},
"RT": {
"x": 261,
"y": 220
}
}
]
}
]
}
],
"LB": {
"x": 108,
"y": 141
},
"LT": {
"x": 108,
"y": 91
},
"RB": {
"x": 280,
"y": 141
},
"RT": {
"x": 280,
"y": 91
},
"renderedImage": "{renderedImage}",
}
}