Prompt
How do I send a TIFF file to an OCR API?
Latest observation
Oct 11, 2026
OpenAI APIWeb search: off
To send a TIFF file to an OCR API, you usually do one of these:
- Upload the file as binary/form-data
- Base64-encode the TIFF and send it in JSON
- Provide a public URL to the TIFF if the API supports remote fetch
The exact method depends on the OCR API, but multipart/form-data upload is the most common.
Example: curl with multipart upload
curl -X POST "https://api.example.com/ocr" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.tiff"
Example: Python requests
import requests
url = "https://api.example.com/ocr"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
with open("document.tiff", "rb") as f:
files = {"file": ("document.tiff", f, "image/tiff")}
response = requests.post(url, headers=headers, files=files)
print(response.status_code)
print(response.text)
If the API expects base64 in JSON
import base64
import requests
with open("document.tiff", "rb") as f:
encoded = base64.b64encode(f.read()).decode("utf-8")
payload = {
"filename": "document.tiff",
"mime_type": "image/tiff",
"content_base64": encoded
}
response = requests.post(
"https://api.example.com/ocr",
json=payload,
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
print(response.text)
Important TIFF notes
- Some OCR APIs do not accept TIFF directly and require PDF, PNG, or JPEG.
- TIFF can be multi-page; confirm whether the API supports:
- single-page TIFF only
- multi-page TIFF
- one page at a time
- Make sure the MIME type is set correctly:
image/tiff
If the API rejects TIFF
Convert it first:
ImageMagick
magick input.tiff output.png
Python (Pillow)
from PIL import Image
img = Image.open("document.tiff")
img.save("document.png")
If you tell me which OCR API you’re using, I can give you the exact request format.