Compress Images Automatically Using ApyHub and n8n (No Coding Required)
Tutorials

Compress Images Automatically Using ApyHub and n8n (No Coding Required)

Learn how to automatically compress images in bulk using n8n and the ApyHub Image Compression API. This step-by-step tutorial explains the full workflow in simple terms, making it easy for both technical and non-technical users to reduce image size and optimize assets without writing any code.
Compress Images Automatically Using ApyHub and n8n (No Coding Required)
PA
Pankaj Kumar
Last updated on January 26, 2026

Automate Image Compression Using ApyHub and n8n (No Coding Required)

Image-heavy workflows are everywhere. From websites and CMS platforms to marketing pipelines and internal tools, images move constantly across systems. But large image files slow down performance, increase storage costs, and often require manual optimization that does not scale.
This tutorial shows how to automatically compress images in bulk using n8n, a visual workflow automation tool, and the ApyHub Image Compression API. The entire workflow is built without writing any application code, making it suitable for developers, product teams, and non-technical users alike.
By the end of this guide, you will have a working automation that downloads images, compresses them using ApyHub, and returns optimized files with a single click.

Table of Contents


What You Will Achieve

By following this tutorial, you will learn how to:
  • Take a list of image URLs
  • Download each image automatically
  • Send images to ApyHub for compression
  • Receive optimized images with reduced file size
  • Run the entire process without writing code
This workflow can be reused for websites, CMS pipelines, marketing assets, or bulk image processing tasks.

Tools Used in This Tutorial

ToolPurpose
n8nVisual workflow automation tool used to build and run the process
ApyHubProvides the Image Compression API that optimizes images automatically

Workflow Overview

The workflow consists of four simple steps:
  1. Start the workflow manually
  2. Generate a list of image URLs
  3. Download each image
  4. Compress each image using the ApyHub Image Compression API
Each step is handled by a node in n8n, allowing you to visually understand and control the process.

Step-by-Step Workflow Setup in n8n

Step 1: Open n8n

Go to the n8n website at:
šŸ‘‰ https://n8n.io

Sign in to your account or create a new one. Once logged in, you will land on the dashboard.

Step 2: Create a New Workflow

From the dashboard:
  1. Click Create Workflow
  2. A blank workflow canvas will open
  3. Click the plus (+) icon to start adding nodes
This canvas is where your automation logic will live.

Step 3: Generate Image URLs Using a Code Node

To simulate real-world image inputs, we start by generating image URLs.
  1. Add a new node and search for Code
  2. Select JavaScript
  3. Paste the following code:
return Array.from({length: 10}, (_, i) => ({
  json: {
    url: `https://picsum.photos/id/${i+1}/800/600.jpg`
  }
}));
  1. Before ad-click Execute Step to generate 10 image URLs.

šŸ”¹ Step 4: Download Images Using HTTP Request Node

  1. Add a new node: HTTP Request
  2. Set Method to GET
  3. Drag the image URL from the previous node into the URL field
  4. Click Execute Step
At this point, n8n downloads each image and stores it as binary data, which can be used by the next node.

šŸ”¹ Step 5: Compress Images Using ApyHub

  1. Add another node: HTTP Request
  2. Set Method to POST
  3. Set the URL to: https://api.apyhub.com/processor/image/compress/file

Headers

Add the following headers:
  • apy-token: Your ApyHub API key
  • content-type: multipart/form-data

Body Configuration

  • Body Content Type: form-data
  • Parameter Type: n8n Binary File
  • Name: image
  • Input Data Field Name: data

Query Parameters

Add the following query parameter:
  • compression_percentage: 20
  1. Click Execute Step
This node sends each downloaded image to the ApyHub Image Compression API, compresses it, and returns the optimized output.

šŸ”— Where to Get the ApyHub Image Compression API URL

🧩 Accessing APIs on ApyHub

If you do not already have an account:
  1. Go to https://apyhub.com
  2. Click Sign Up (free plan available)
  3. Verify your email and log in
If you already have an account:
  • Just log in to your dashboard

Finding the Compress Image API

After logging in:
  1. Go to your Dashboard
  2. Click Catalog in the top-left menu
  3. Search for Compress Image API
From the API page, you can copy the endpoint and paste it directly into your n8n workflow.

Configuring API Parameters in n8n

  • Enable Send Query Parameters to set compression options
  • The required query parameters are listed on the Compress Image API page
  • The required headers are available in the cURL example under the Headers section
  • Add the required body parameter:
  • Set Body Content Type to form-data
  • Set Parameter Type to n8n Binary File
  • Set Input Data Field Name to data

Reliability Settings

After configuring all parameters:
  1. Click Settings (next to Parameters)
  2. Enable Retry on Fail
  3. Set Max Tries (for example, 100)
  4. Execute the node
We configure Max Tries so that if the API request fails due to temporary issues, n8n automatically retries instead of stopping the workflow.

Note: Make sure to review the API usage limits for the Starter plan in your ApyHub dashboard before running the workflow at scale.