← Back to Blog

Convert Images with an API — Automate HEIC, WebP, and AVIF Conversion

I got an email a few months ago from a guy running a real estate photography business. He shoots properties with an iPhone, gets HEIC files, and needs to deliver JPGs to agents on a listing platform that only accepts JPEG uploads. He was converting photos one at a time on our site. Forty photos per property. Three properties a day.

His exact words: “Is there a way to script this?”

That’s the kind of request that makes you realize you need an API.

Why an image conversion API exists

Most image conversion happens manually. You open a tool, drop a file, pick your format, download the result. That’s fine for five photos. It falls apart when you’re dealing with hundreds of files a week, or when the conversion needs to happen as part of some larger workflow without a human clicking buttons.

A few scenarios where an API makes sense:

Automated intake. A real estate company receives listing photos from dozens of agents, each shooting on different phones. Some send HEIC, some send JPEG, a few somehow send TIFF. An API call during upload standardizes everything to JPEG before it hits their database — no human involved.

Batch processing is the other big one. Say you’ve got a folder of 200 WebP screenshots from a web scraping job and your reporting tool only reads PNG. A simple loop through the API converts them all in a few minutes, no babysitting required.

Then there’s mobile app backends. iPhones send HEIC, Android sends JPEG, web browsers send whatever. Normalizing to one format server-side keeps your processing pipeline sane, and an API call is a single line of code in your upload handler.

Content teams run into this too — they upload images in random formats, and before anything hits the CDN, you want everything as optimized WebP with a JPEG fallback. Dropping an API call into the build pipeline handles that automatically.

What our API does

The heic.site API is a simple REST endpoint. Send a POST request with an image file, specify the output format, get back the converted file. That’s it.

Supported inputs: HEIC, AVIF, WebP, PNG, JPEG, GIF, BMP, TIFF. Supported outputs: JPEG, PNG, WebP, AVIF, PDF.

You authenticate with an API key that you generate from your account page. The key goes in the Authorization header. Standard stuff.

A basic request looks something like this:

curl -X POST https://heic.site/api/v1/convert \
  -H "Authorization: Bearer hc_your_api_key_here" \
  -F "file=@photo.heic" \
  -F "format=jpeg" \
  -F "quality=90" \
  -o converted.jpg

Quality is optional and only applies to lossy formats (JPEG, WebP, AVIF). PNG and PDF ignore it.

What it costs

The API is included with heic.site Pro ($8/month or $60/year). No per-request fees, no usage tiers, no overage charges. Your API key activates when you subscribe and works as long as your subscription is active.

We do have rate limits to prevent abuse — enough for any reasonable workload, but not enough to let someone hammer our infrastructure. If you have a use case that needs higher throughput, reach out and we’ll figure something out.

Why not use Sharp, ImageMagick, or ffmpeg?

You absolutely should if you can. Those are battle-tested tools that handle image conversion at any scale. The reason people reach for an API instead usually comes down to one of these:

The most common reason is no server access. Serverless platforms, mobile apps, restricted hosting environments — if you can’t install native binaries, Sharp and ImageMagick aren’t options. An HTTP API works from anywhere with a network connection.

HEIC is also just a pain to self-host. Converting HEIC files requires the libheif library and HEVC codecs, which have patent licensing complications. Getting that running on a Linux server is doable but annoying. Getting it running in a Docker container that also needs to handle WebP, AVIF, and TIFF? I’ve watched people lose entire days on this. Our API abstracts all of that away.

There’s also the maintenance side. Image processing libraries need updates, security patches, and configuration. If image conversion isn’t your core product, that’s ongoing work for something tangential to what you actually do.

And sometimes it’s just about speed. Need image conversion working today for a prototype? Installing and configuring ImageMagick can eat an afternoon. An API call works in five minutes.

When NOT to use an API

If you’re processing thousands of images per hour, a self-hosted solution will be cheaper and faster. API latency adds up at scale, and you’re paying for bandwidth in both directions (upload the original, download the converted file).

If all your images are JPEG and PNG, you don’t need a conversion API at all. Those formats are universally supported. The API is most useful when you’re dealing with HEIC, AVIF, or WebP — formats that not every tool can handle natively.

If privacy is critical and you can’t send files to any external service, host your own conversion pipeline. Our API processes files on secure cloud infrastructure and deletes them immediately after conversion, but “immediately deleted” and “never left my network” are different guarantees.

How to set it up

  1. Sign up at heic.site and subscribe to Pro
  2. Go to your account page and generate an API key
  3. Make your first API call using the curl example above
  4. Check the response headers for rate limit info

We’re still finalizing the full API documentation with edge cases, error codes, and SDK examples. For now, the endpoint accepts multipart form uploads and returns the converted file as the response body. Pretty standard REST patterns.

If you run into issues or need a format we don’t support yet, let me know. The API is new and I’m actively iterating on it based on what people actually need.