Image Translation (Text)
    • PDF

    Image Translation (Text)

    • PDF

    Article summary

    Available in Classic and VPC

    Recognize (OCR) text in images in JPG, JPEG, PNG, and TIFF formats and provide translated text.

    Note

    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:

    MethodURI
    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.

    FieldTypeRequiredDescription
    sourceStringRequiredLanguage code of the source text (source)
    • auto (automatic language detection) | ko (Korean) | en (English) | ja (Japanese) | zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian)
    targetStringRequiredLanguage code of the text to translate to (target)
    • ko (Korean) | en (English) | ja (Japanese) | zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian) | de (German) | it (Italian)
    imageJPG, JPEG, PNG, TIFFRequiredOriginal image file
    Note

    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-text/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: multipart/form-data' \
    --form 'source="auto"' \
    --form 'target="ko"' \
    --form 'image=@"{image}"'
    

    Response

    The following describes the response format.

    Response body

    The following describes the response body.

    FieldTypeRequiredDescription
    dataObject-Response result
    data.sourceLangString-Source text language code
    data.targetLangString-Translated text language code
    data.sourceTextString-Source text
    data.targetTextString-Translated text
    data.blocksArray-Block-unit text recognition details
    data.LBObject-Left bottom coordinate details
    data.LB.xInteger-Left bottom coordinate x value
    data.LB.yInteger-Left bottom coordinate y value
    data.LTObject-Left top coordinate details
    data.LT.xInteger-Left top coordinate x value
    data.LT.yInteger-Left top coordinate y value
    data.RBObject-Right bottom coordinate details
    data.RB.xInteger-Right bottom coordinate x value
    data.RB.yInteger-Right bottom coordinate y value
    data.RTObject-Right top coordinate details
    data.RT.xInteger-Right top coordinate x value
    data.RT.yInteger-Right top coordinate y value

    blocks

    The following describes blocks.

    FieldTypeRequiredDescription
    sourceLangString-Source text language code
    sourceTextString-Source text
    targetTextString-Translated text
    linesArray-Line-unit text recognition details

    lines

    The following describes lines.

    FieldTypeRequiredDescription
    LBObject-Left bottom coordinate details
    LB.xInteger-Left bottom coordinate x value
    LB.yInteger-Left bottom coordinate y value
    LTObject-Left top coordinate details
    LT.xInteger-Left top coordinate x value
    LT.yInteger-Left top coordinate y value
    RBObject-Right bottom coordinate details
    RB.xInteger-Right bottom coordinate x value
    RB.yInteger-Right bottom coordinate y value
    RTObject-Right top coordinate details
    RT.xInteger-Right top coordinate x value
    RT.yInteger-Right top coordinate y value
    wordsArray-Word-unit text recognition details

    words

    The following describes words.

    FieldTypeRequiredDescription
    sourceTextString-Source text
    LBObject-Left bottom coordinate details
    LB.xInteger-Left bottom coordinate x value
    LB.yInteger-Left bottom coordinate y value
    LTObject-Left top coordinate details
    LT.xInteger-Left top coordinate x value
    LT.yInteger-Left top coordinate y value
    RBObject-Right bottom coordinate details
    RB.xInteger-Right bottom coordinate x value
    RB.yInteger-Right bottom coordinate y value
    RTObject-Right top coordinate details
    RT.xInteger-Right top coordinate x value
    RT.yInteger-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
        }
    }
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.