Image Translation(Text) API
    • PDF

    Image Translation(Text) API

    • PDF

    Article Summary

    Image Translation(Text) API

    • The Image Translation (Text) API recognizes and extracts text from images via optical character recognition (OCR) to provide translated text.
    • Even if the source language isn’t specified, the API automatically detects the language and provides a translation. In this case, additional fees do not incur for detecting languages but only for the number of characters requested for translation.

    API URL

    MethodRequest URLOutput format
    POSThttps://naveropenapi.apigw.ntruss.com/image-to-text/v1/translateJSON

    Header

    NameDescription
    Content-TypeRequires sending in multipart/form-data format
    X-NCP-APIGW-API-KEY-IDClient ID issued when registering the NAVER Cloud Platform app
    X-NCP-APIGW-API-KEYSecret key issued when registering the NAVER Cloud Platform app

    Parameter

    NameTypeRequiredDescription
    sourceStringtrueSource language code.
    If set to auto, the source language is automatically detected.
    targetStringtrueTarget language code
    imageFiletrueOriginal image file

    Supported Languages Source language: Korean, English, Japanese, Chinese (Simplified & Traditional), Vietnamese, Thai, Indonesian, French, Spanish, Russian

    Target language: Korean, English, Japanese, Chinese (Simplified & Traditional), Vietnamese, Thai, Indonesian, French, Spanish, Russian, German, Italian

    LanguageLanguage code
    Koreanko
    Englishen
    Japaneseja
    Chinese (Simplified)zh-CN
    Chinese (Traditional)zh-TW
    Vietnamesevi
    Thaith
    Indonesianid
    Frenchfr
    Spanishes
    Russianru
    Germande
    Italianit

    Response returned in JSON format

    Field NameTypeDescription
    dataJSON Object
    data.sourceLangStringSource language code
    data.targetLangStringTarget language code
    data.sourceTextStringSource text
    data.targetTextStringTranslated text
    data.blocksJSON ArrayOCR information by block
    data.blocks[].sourceLangStringSource language code
    data.blocks[].sourceTextStringSource text
    data.blocks[].targetTextStringTranslated text
    data.blocks[].lbJSON ObjectLeft bottom coordinates (Internal x and y fields exist)
    data.blocks[].ltJSON ObjectTop-left coordinates (Internal x and y fields exist)
    data.blocks[].rbJSON ObjectBottom-right coordinates (Internal x and y fields exist)
    data.blocks[].rtJSON ObjectTop-right coordinates (Internal x and y fields exist)
    data.blocks[].linesJSON ArrayOCR information by line
    data.blocks[].lines[].lbJSON ObjectLeft bottom coordinates (Internal x and y fields exist)
    data.blocks[].lines[].ltJSON ObjectTop-left coordinates (Internal x and y fields exist)
    data.blocks[].lines[].rbJSON ObjectBottom-right coordinates (Internal x and y fields exist)
    data.blocks[].lines[].rtJSON ObjectTop-right coordinates (Internal x and y fields exist)
    data.blocks[].lines[].wordsJSON ArrayOCR information by word
    data.blocks[].lines[].words[].sourceTextStringSource text
    data.blocks[].lines[].words[].lbJSON ObjectLeft bottom coordinates (Internal x and y fields exist)
    data.blocks[].lines[].words[].ltJSON ObjectTop-left coordinates (Internal x and y fields exist)
    data.blocks[].lines[].words[].rbJSON ObjectBottom-right coordinates (Internal x and y fields exist)
    data.blocks[].lines[].words[].rtJSON ObjectTop-right coordinates (Internal x and y fields exist)

    CURL Example

    $ curl --location --request POST 'https://naveropenapi.apigw.ntruss.com/image-to-text/v1/translate' \
    -H "X-NCP-APIGW-API-KEY-ID:{Client ID value issued upon application registration}" \
    -H "X-NCP-APIGW-API-KEY:{Client secret value issued upon application registration}" \
    --form 'image=@"/Users/user/a.png"' \
    --form 'source="ko"' \
    --form 'target="en"'
    {"data":{"sourceLang":"ko","targetLang":"en","sourceText":"NEW\nGURSKEN\n구르스켄\n옷장\n49x55x186 cm\n라이트베이지\n₩79, 900\nIKEA","targetText":"NEW\nGURSKEN\nGursken.\nCloset\n49x55x186 cm\nLight beige.\n₩79, 900\nIKEA","blocks":[{"sourceLang":"ko","sourceText":"NEW","targetText":"NEW","lines":[{"lb":{"x":395,"y":57},"lt":{"x":407,"y":7},"rb":{"x":515,"y":84},"rt":{"x":526,"y":33}}],"lb":{"x":395,"y":57},"lt":{"x":406,"y":6},"rb":{"x":515,"y":83},"rt":{"x":526,"y":33}},{"sourceLang":"ko","sourceText":"구르스켄","targetText":"GURSKEN","lines":[{"lb":{"x":383,"y":238},"lt":{"x":391,"y":184},"rb":{"x":637,"y":272},"rt":{"x":645,"y":217}}],"lb":{"x":383,"y":238},"lt":{"x":390,"y":182},"rb":{"x":637,"y":272},"rt":{"x":645,"y":217}},{"sourceLang":"ko","sourceText":"구르스켄","targetText":"Gursken.","lines":[{"lb":{"x":387,"y":319},"lt":{"x":392,"y":268},"rb":{"x":541,"y":333},"rt":{"x":545,"y":283}}],"lb":{"x":387,"y":319},"lt":{"x":391,"y":267},"rb":{"x":541,"y":333},"rt":{"x":545,"y":281}},{"sourceLang":"ko","sourceText":"옷장","targetText":"Closet","lines":[{"lb":{"x":394,"y":417},"lt":{"x":395,"y":355},"rb":{"x":497,"y":419},"rt":{"x":499,"y":358}}],"lb":{"x":393,"y":416},"lt":{"x":394,"y":354},"rb":{"x":497,"y":419},"rt":{"x":498,"y":357}},{"sourceLang":"ko","sourceText":"49x55x186 cm","targetText":"49x55x186 cm","lines":[{"lb":{"x":395,"y":465},"lt":{"x":396,"y":441},"rb":{"x":537,"y":469},"rt":{"x":538,"y":444}}],"lb":{"x":394,"y":465},"lt":{"x":395,"y":439},"rb":{"x":537,"y":469},"rt":{"x":537,"y":444}},{"sourceLang":"ko","sourceText":"라이트베이지","targetText":"Light beige.","lines":[{"lb":{"x":397,"y":504},"lt":{"x":397,"y":475},"rb":{"x":516,"y":504},"rt":{"x":516,"y":475}}],"lb":{"x":397,"y":504},"lt":{"x":397,"y":475},"rb":{"x":516,"y":504},"rt":{"x":516,"y":475}},{"sourceLang":"ko","sourceText":"₩79, 900","targetText":"₩79, 900","lines":[{"lb":{"x":452,"y":891},"lt":{"x":444,"y":813},"rb":{"x":721,"y":864},"rt":{"x":713,"y":786}}],"lb":{"x":451,"y":891},"lt":{"x":444,"y":813},"rb":{"x":721,"y":864},"rt":{"x":713,"y":785}},{"sourceLang":"ko","sourceText":"IKEA","targetText":"IKEA","lines":[{"lb":{"x":564,"y":1141},"lt":{"x":560,"y":1125},"rb":{"x":620,"y":1127},"rt":{"x":616,"y":1111}}],"lb":{"x":564,"y":1141},"lt":{"x":560,"y":1125},"rb":{"x":620,"y":1127},"rt":{"x":616,"y":1111}}]}}
    

    Python Example

    import requests
    from requests_toolbelt import MultipartEncoder
    import uuid
    
    data = {
      'source': 'ko',
      'target': 'en',
      'image': ('a.png', open('a.png', 'rb'), 'application/octet-stream', {'Content-Transfer-Encoding': 'binary'})
    }
    m = MultipartEncoder(data, boundary=uuid.uuid4())
    
    headers = {
      "Content-Type": m.content_type,
      "X-NCP-APIGW-API-KEY-ID": User_client_ID
      "X-NCP-APIGW-API-KEY": User_client_secret
    }
    
    url = "https://naveropenapi.apigw.ntruss.com/image-to-text/v1/translate"
    res = requests.post(url, headers=headers, data=m.to_string())
    print(res.text)
    

    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.