File Conversion API

A free, open source REST API for file conversion. Convert between image formats, resize, compress, extract text from PDFs, and more โ€” all in memory, nothing stored on disk.

โœ“ Free & Open Source โœ“ No API Key Required โœ“ Files Never Stored Self-Hostable MIT License

Overview

All operations happen entirely in memory. Files are processed and returned immediately โ€” no temporary files are written to disk, and nothing is retained after the response is sent.

Supported Image Formats

PNG
JPG
WebP
GIF
BMP
TIFF

PDF Operations

OperationDescriptionOutput
Text extractionExtract raw text from all pagesJSON
Page to imagesRender each page as an imageZIP file
MetadataPage count, author, dimensions, encryptionJSON

Base URL

https://file-conversion-api-xnhs.onrender.com

All endpoints accept multipart/form-data. JSON responses use application/json. File responses include a Content-Disposition: attachment header.

Authentication

๐Ÿ”“ No authentication required. All endpoints are publicly accessible. CORS is enabled for all origins.

File Limits

ConstraintValue
Max file size20 MB per request
Max image dimension (resize)10,000 ร— 10,000 px
PDF to images DPI72 โ€“ 300 DPI
Quality range (JPG/WebP)1 โ€“ 100

โš ๏ธ Converting a large PDF to images at 300 DPI is memory-intensive. For files over 10MB, use 150 DPI or lower.

Rate Limiting

EndpointLimit
Image endpoints30 requests / minute per IP
PDF text / info30 requests / minute per IP
PDF to images10 requests / minute per IP

Exceeded limits return HTTP 429 with a Retry-After header.

Image Endpoints

POST /convert/image Convert image to another format

Form Fields

FieldTypeRequiredDefaultDescription
fileFilerequiredโ€”Input image file.
formatstringoptionalpngOutput format: png, jpg, webp, gif, bmp, tiff.
qualityintegeroptional85Compression quality 1โ€“100 (applies to JPG and WebP only).

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image \
  -F "file=@photo.png" \
  -F "format=webp" \
  -F "quality=80" \
  --output converted.webp

Returns the converted image file with appropriate Content-Type and Content-Disposition headers.

POST /convert/image/resize Resize an image to specific dimensions

Form Fields

FieldTypeRequiredDefaultDescription
fileFilerequiredโ€”Input image.
widthintegerrequiredโ€”Target width in pixels.
heightintegerrequiredโ€”Target height in pixels.
keep_aspectbooleanoptionaltruePreserve aspect ratio (thumbnail mode). If false, stretches to exact dimensions.
formatstringoptionalpngOutput format.
qualityintegeroptional85Quality 1โ€“100 (JPG/WebP only).

Response Headers

HeaderDescription
X-Original-SizeOriginal dimensions, e.g. 1920x1080
X-Output-SizeFinal dimensions after resizing

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image/resize \
  -F "file=@photo.jpg" \
  -F "width=800" \
  -F "height=600" \
  -F "keep_aspect=true" \
  -F "format=jpg" \
  --output resized.jpg
POST /convert/image/compress Compress an image and report size reduction

Form Fields

FieldTypeRequiredDefaultDescription
fileFilerequiredโ€”Input image.
qualityintegeroptional60Output quality 1โ€“100. Lower = smaller file.
formatstringoptionalSame as inputOutput format (defaults to same as input).

Response Headers

HeaderDescription
X-Original-Size-BytesInput file size in bytes
X-Compressed-Size-BytesOutput file size in bytes
X-Compression-RatioSize reduction, e.g. 42.3%

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/image/compress \
  -F "file=@photo.jpg" \
  -F "quality=50" \
  --output compressed.jpg -v

PDF Endpoints

POST /convert/pdf/text Extract text content from a PDF

Form Fields

FieldTypeRequiredDescription
fileFilerequiredInput PDF file.

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/text \
  -F "file=@document.pdf"

Example Response

{
  "page_count": 3,
  "full_text": "Introduction\n\nThis document describes...",
  "pages": [
    { "page": 1, "text": "Introduction\n\nThis document describes..." },
    { "page": 2, "text": "Chapter 1: Getting Started..." },
    { "page": 3, "text": "" }
  ]
}

๐Ÿ’ก Text extraction works only on text-based PDFs. Scanned image PDFs will return empty strings per page โ€” use OCR software for those.

POST /convert/pdf/images Convert each PDF page to an image โ€” returns a ZIP

Form Fields

FieldTypeRequiredDefaultDescription
fileFilerequiredโ€”Input PDF.
formatstringoptionalpngpng or jpg.
dpiintegeroptional150Render resolution (72โ€“300). Higher = sharper but larger files.

Returns a application/zip file named pdf_pages.zip containing page_1.png, page_2.png, etc.

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/images \
  -F "file=@document.pdf" \
  -F "format=png" \
  -F "dpi=150" \
  --output pages.zip

โš ๏ธ Requires poppler-utils to be installed on the server. Included in the Render deployment via render.yaml.

POST /convert/pdf/info Extract metadata and page info from a PDF

Form Fields

FieldTypeRequiredDescription
fileFilerequiredInput PDF.

Example Request

curl -X POST https://file-conversion-api-xnhs.onrender.com/convert/pdf/info \
  -F "file=@document.pdf"

Example Response

{
  "page_count": 5,
  "encrypted": false,
  "file_size_bytes": 204800,
  "metadata": {
    "title": "Annual Report 2025",
    "author": "Jane Doe",
    "subject": null,
    "creator": "Microsoft Word",
    "producer": "Adobe PDF Library",
    "creation_date": "D:20250115120000",
    "modification_date": "D:20250116090000"
  },
  "pages": [
    { "page": 1, "width_pt": 595.28, "height_pt": 841.89 },
    { "page": 2, "width_pt": 595.28, "height_pt": 841.89 }
  ]
}

Utility Endpoints

GET /formats List all supported formats
{
  "image_input": ["png", "jpg", "jpeg", "webp", "gif", "bmp", "tiff"],
  "image_output": ["png", "jpg", "jpeg", "webp", "gif", "bmp", "tiff"],
  "pdf_operations": ["text", "images", "info"]
}
GET /health Health check
{ "status": "ok" }

Error Codes

CodeMeaningCommon Cause
400Bad RequestUnsupported format, invalid quality/DPI, non-PDF file sent to PDF endpoint, corrupt image.
413Payload Too LargeFile exceeds the 20 MB limit.
429Too Many RequestsRate limit exceeded.
501Not Implementedpdf2image / poppler not installed on the server.

Error Response Format

{ "detail": "File exceeds 20MB limit." }

Self-Hosting

Dependencies

pdf2image (used by POST /convert/pdf/images) requires poppler:

# Ubuntu / Debian
apt-get install -y poppler-utils

# macOS
brew install poppler

Run locally

git clone https://github.com/your-username/file-conversion-api
cd file-conversion-api
pip install -r requirements.txt
uvicorn main:app --reload

Interactive docs at http://localhost:8000/docs

Deploy on Render

The render.yaml automatically installs poppler-utils as a build step. Connect your GitHub repo and Render handles the rest.