Image Converter API

Perform 500+ Different Image Conversions with Our Secure and Scalable API.

hero banner

Code Examples in Popular Languages

Integrate our Image Converter API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/image-converter' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'from="png"' \
--form 'to="pdf"' \
--form 'file=@"/D:/data/Images/png/image.png"' \
--form 'file=@"/D:/data/Images/png/largepreview.png"'
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("from", "png");
formdata.append("to", "pdf");
formdata.append("file", fileInput.files[0], "[PROXY]");
formdata.append("file", fileInput.files[0], "[PROXY]");

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

fetch("https://theonlineconverter.com/api/v1/image-converter", 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-converter"

payload = {'from': 'png',
'to': 'pdf'}
files=[
  ('file',('image.png',open('/D:/data/Images/png/image.png','rb'),'image/png')),
  ('file',('largepreview.png',open('/D:/data/Images/png/largepreview.png','rb'),'image/png'))
]
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-converter"

payload = {'from': 'png',
'to': 'pdf'}
files=[
  ('file',('image.png',open('/D:/data/Images/png/image.png','rb'),'image/png')),
  ('file',('largepreview.png',open('/D:/data/Images/png/largepreview.png','rb'),'image/png'))
]
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' => 'from',
      'contents' => 'png'
    ],
    [
      'name' => 'to',
      'contents' => 'pdf'
    ],
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Images/png/image.png', 'r'),
      'filename' => '/D:/data/Images/png/image.png',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ],
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Images/png/largepreview.png', 'r'),
      'filename' => '/D:/data/Images/png/largepreview.png',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/image-converter', $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("from","png")
  .addFormDataPart("to","pdf")
  .addFormDataPart("file","",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Images/png/image.png")))
  .addFormDataPart("file","",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Images/png/largepreview.png")))
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/image-converter")
  .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-converter"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("from", "png")
  _ = writer.WriteField("to", "pdf")
  file, errFile3 := os.Open("/D:/data/Images/png/image.png")
  defer file.Close()
  part3,
         errFile3 := writer.CreateFormFile("file",filepath.Base("/D:/data/Images/png/image.png"))
  _, errFile3 = io.Copy(part3, file)
  if errFile3 != nil {
    fmt.Println(errFile3)
    return
  }
  file, errFile4 := os.Open("/D:/data/Images/png/largepreview.png")
  defer file.Close()
  part4,
         errFile4 := writer.CreateFormFile("file",filepath.Base("/D:/data/Images/png/largepreview.png"))
  _, errFile4 = io.Copy(part4, file)
  if errFile4 != nil {
    fmt.Println(errFile4)
    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-converter", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddParameter("from", "png");
request.AddParameter("to", "pdf");
request.AddFile("file", "/D:/data/Images/png/image.png");
request.AddFile("file", "/D:/data/Images/png/largepreview.png");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our API is engineered for maximum flexibility, quality, and performance across all conversion types.

Simple User Interface

Massive Format Support

Convert between over 500 format combinations. Our API supports everything from common web formats (JPG, PNG, WEBP, GIF) to professional (TIFF, BMP) and modern formats (HEIC, AVIF).

Simple Data Format

Adjustable Quality Control

Fine-tune the output by setting the quality and compression levels for lossy formats like JPG and WEBP, allowing you to perfectly balance file size and visual fidelity.

Time

Alpha Channel Preservation

Reliably convert formats that support transparency (like PNG and WEBP). The alpha channel is perfectly preserved, ensuring your transparent backgrounds are maintained.

Secure Data

Animated Format Support

Seamlessly convert between animated formats like GIF, animated WEBP, and APNG, preserving all frames and animation timing.

Universal Access

Metadata Control

Choose to retain or strip EXIF and other metadata from your images during conversion, helping to reduce file size and protect privacy.

Freedom

Secure & Confidential

All images are processed over encrypted connections. We guarantee confidentiality with a strict data privacy policy and do not store your files.

Frequently Asked Questions

Find answers to common questions about our Image Converter API to understand its capabilities and best use cases.

Different devices and applications create and require different formats. Supporting 500+ conversions ensures your application can handle any user-uploaded image (like a modern HEIC from an iPhone) and convert it to a universally compatible format (like JPG) for display.

It depends on the formats. Converting from a high-quality format to a lossy format like JPG will involve some compression. Converting between lossless formats (like PNG to BMP) will not degrade quality. Our API gives you control over the compression level to manage this.

To preserve transparency, you should convert your source image to a format that supports it, such as PNG, WEBP, GIF, or TIFF. Converting a transparent image to JPG will result in a solid background.

Yes. You can convert an animated GIF to an animated WEBP (for better compression) or APNG. You can also extract individual frames by converting it to a non-animated format like PNG or JPG.

Absolutely. You can pass resizing, cropping, or rotation parameters within the same API call as your format conversion, creating an efficient, all-in-one image processing step.

Conversions are extremely fast, typically taking only a second or two depending on the image size. Our infrastructure is built to handle high-volume batch processing quickly.

Yes. We use end-to-end TLS encryption for all data transfers. Your images are processed securely and are permanently deleted from our servers immediately after the job is complete.