Image to Text API

Extract Text from Images with Unparalleled Accuracy and Speed using our OCR API.

hero banner

Code Examples in Popular Languages

Integrate our Image to Text API effortlessly into your applications. We provide comprehensive code examples in all popular programming languages to help you get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/image-to-text' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'file=@"/D:/data/Document/pdf/bill.pdf"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("file", fileInput.files[0], "[PROXY]");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/image-to-text", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/image-to-text"

payload = {}
files=[
  ('file',('bill.pdf',open('/D:/data/Document/pdf/bill.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/image-to-text"

payload = {}
files=[
  ('file',('bill.pdf',open('/D:/data/Document/pdf/bill.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Document/pdf/bill.pdf', 'r'),
      'filename' => '/D:/data/Document/pdf/bill.pdf',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/image-to-text', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("file","",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Document/pdf/bill.pdf")))
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/image-to-text")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/image-to-text"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  file, errFile1 := os.Open("/D:/data/Document/pdf/bill.pdf")
  defer file.Close()
  part1,
         errFile1 := writer.CreateFormFile("file",filepath.Base("/D:/data/Document/pdf/bill.pdf"))
  _, errFile1 = io.Copy(part1, file)
  if errFile1 != nil {
    fmt.Println(errFile1)
    return
  }
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("https://theonlineconverter.com/api/v1/image-to-text", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddFile("file", "/D:/data/Document/pdf/bill.pdf");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our advanced OCR engine provides robust features for precise and adaptable image to text conversion, designed for various use cases.

Simple User Interface

High Accuracy OCR

Leverage state-of-the-art Optical Character Recognition technology to achieve exceptional accuracy in converting printed text from various image sources into digital format.

Simple Data Format

Versatile Image Input

Accepts a wide range of image formats including JPG, PNG, TIFF, BMP, and GIF, providing maximum flexibility for your source content.

Time

Lightning-Fast Processing

Benefit from incredibly quick text extraction, allowing for real-time applications and efficient processing of large batches of images without delay.

Secure Data

Structured Output

Receive extracted text in a clean, plain text format or as structured JSON, complete with bounding box coordinates for precise text location and analysis.

Universal Access

Multi-Language Support

Process images containing text in over 100 languages, making our API a versatile solution for global applications and diverse document content.

Freedom

Secure & Compliant

Your data security is paramount. All image uploads and text extractions are processed under strict security protocols and robust data privacy standards.

Frequently Asked Questions

Get quick answers to common questions about our Image to Text API, helping you understand its functionalities and how to best utilize them.

Our API can process various image types including scanned documents, photographs of text, screenshots, digital images containing text, and even image-based PDFs.

We use an advanced OCR engine designed for high accuracy. Performance may vary slightly based on image quality, text clarity, and font styles in the source image.

Our API supports over 100 languages. You can specify the desired language in your API request for optimal recognition results.

You can choose to receive the extracted text as plain text or as a structured JSON object, which includes additional details like bounding box coordinates.

We employ robust encryption and strict data handling policies. Images are processed securely and deleted from our servers after a short, defined period, adhering to privacy regulations.