Back to blog
TechnicalMarch 23, 20264 min readKonvrt Team

Building an Image Processing Pipeline with a Conversion API

Developer tutorial for integrating an image conversion API into your workflow. Covers batch format conversion, webhook callbacks, and code examples in JavaScript.

Building an Image Processing Pipeline with a Conversion API

When you need to convert, compress, or transform images programmatically — in a CI/CD pipeline, CMS workflow, or automated system — a conversion API replaces manual batch processing with code.

Here's how to build a reliable image processing pipeline.

Why Use an API?

Manual conversion works for occasional tasks. An API is better when:

  • Images arrive continuously (user uploads, product imports)
  • You need consistent output specs across thousands of images
  • Processing is part of a larger automated workflow
  • Multiple team members or systems need the same conversion logic
  • You want to trigger conversion from code, not a GUI

Architecture Overview

A typical image processing pipeline:

Upload → Validate → Convert → Optimize → Store → Notify
  1. Upload — User or system provides the source image
  2. Validate — Check format, dimensions, and file size
  3. Convert — Transform to target format (e.g., HEIC → WebP)
  4. Optimize — Compress to target quality and dimensions
  5. Store — Save to your storage (S3, GCS, etc.)
  6. Notify — Webhook callback when processing completes

Basic API Integration

Converting an Image

const formData = new FormData();
formData.append('file', imageBuffer, 'product.heic');

const response = await fetch('https://konvrt.io/api/v1/convert', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
  body: formData,
});

const result = await response.json();
// { jobId: "abc123", status: "completed", downloadUrl: "..." }

Downloading the Result

const download = await fetch(
  `https://konvrt.io/api/v1/download/${result.jobId}`,
  {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
  }
);

const convertedImage = await download.arrayBuffer();

Handling Async Processing

For larger files or video processing, jobs run asynchronously. Use webhooks to get notified when processing completes:

const response = await fetch('https://konvrt.io/api/v1/convert', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
  body: formData,
});

// Poll for status or use webhook
const status = await fetch(
  `https://konvrt.io/api/v1/status/${jobId}`,
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);

Pipeline Patterns

E-Commerce Product Import

async function processProductImage(imageUrl, productId) {
  // 1. Fetch source image
  const source = await fetch(imageUrl);
  const buffer = await source.arrayBuffer();

  // 2. Convert to WebP for web display
  const webVersion = await convertImage(buffer, {
    format: 'webp',
    quality: 80,
    maxWidth: 1200,
  });

  // 3. Create thumbnail
  const thumbnail = await convertImage(buffer, {
    format: 'webp',
    quality: 70,
    maxWidth: 300,
  });

  // 4. Store both versions
  await storage.upload(`products/${productId}/main.webp`, webVersion);
  await storage.upload(`products/${productId}/thumb.webp`, thumbnail);
}

User Avatar Processing

async function processAvatar(uploadedFile) {
  return await convertImage(uploadedFile, {
    format: 'webp',
    quality: 80,
    width: 200,
    height: 200,
    crop: 'center',
  });
}

Error Handling

Robust pipelines handle failures gracefully:

async function convertWithRetry(file, options, maxRetries = 3) {
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      const result = await convertImage(file, options);
      return result;
    } catch (error) {
      if (attempt === maxRetries) throw error;
      // Exponential backoff
      await new Promise(r => setTimeout(r, 1000 * Math.pow(2, attempt)));
    }
  }
}

Rate Limiting

Konvrt's API allows 60 requests per minute. For high-volume processing:

  • Queue your requests — use a job queue to stay under rate limits
  • Batch where possible — process multiple images in fewer requests
  • Cache results — don't re-convert images you've already processed
  • Handle 429 responses — implement backoff when rate limited

Credit Planning

API credits scale with usage:

Pack Credits Cost Approx. Images
Starter 1,000 $5 ~1,000 small images
Growth 5,000 $20 ~5,000 small images
Scale 20,000 $60 ~20,000 small images

Credits are consumed based on input file size (~1 credit per 10 MB). A typical product photo (2-5 MB) uses about 1 credit.

Getting Started

  1. Sign up for a Pro or Team plan to get API access
  2. Generate an API key in your dashboard
  3. Start with the API documentation for full endpoint reference
  4. Test with a single image before building your pipeline
Built for fast file workflows

Convert, optimize, and ship files without sending them away first.

Konvrt keeps the experience simple: local-first processing when possible, clear pricing, strong privacy defaults, and focused tools for repetitive file work.

Local-first

Files stay on your device for supported browser workflows.

Fast answers

Use FAQ, docs, and contact paths without hunting around the site.

Clear upgrades

Move from free workflows to paid access without confusing plan language.