Automate Image Optimization in Google Drive with n8n

Save hours managing large image files by automating image optimization in your Google Drive folders with n8n and TinyPNG. This workflow automatically detects new images, optimizes them, and reuploads the compressed versions to a designated folder, reducing file size and improving workflow efficiency.
googleDriveTrigger
googleDrive
httpRequest
+1
Workflow Identifier: 1763
NODES in Use: Google Drive Trigger, Google Drive, HTTP Request, Sticky Note
Automate image optimization with n8n and Google Drive

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow watches a Google Drive folder for new images.

When a new image is added, it downloads the file and sends it to TinyPNG for compression.

After TinyPNG makes the image smaller, the workflow downloads the compressed image and uploads it to another Google Drive folder.

This process runs automatically every minute to keep images optimized without manual steps.


Tools and Services Used


Inputs, Processing, and Outputs

Inputs

Processing Steps

  • Trigger detects new image file in Google Drive.
  • Download the image file’s binary data.
  • Send image binary data to TinyPNG API with tiny image compression request.
  • Receive a link from TinyPNG to download the optimized image.
  • Download optimized image from TinyPNG.
  • Upload the optimized image to a separate Google Drive folder with “-optimised” added to the file name.

Outputs


Beginner Step-by-Step: How to Use This Workflow in n8n

Import Workflow

  1. Click the “Download” button on this page to save the workflow file.
  2. Open the n8n editor where you want to run the automation.
  3. Use the “Import from File” option in n8n to import the downloaded workflow.

Configure Credentials and Settings

  1. Add your Google OAuth2 credentials to access Google Drive.
  2. Enter your TinyPNG API Key in the HTTP Request node’s Authorization header.
  3. Check and update any folder IDs for the Google Drive Trigger and Upload nodes to point to the correct folders.

Test and Activate

  1. Upload a small test image to the monitored Google Drive folder and check if the workflow runs automatically.
  2. If successful, verify that the optimized image appears in the target folder with the “-optimised” suffix.
  3. Activate the workflow inside n8n by toggling the switch on the workflow editor screen.

This lets the workflow run all the time and process new images as they come in.


Customizations and Tips

  • Change the Google Drive folder monitored by the trigger node to fit your needs.
  • Filter image types (PNG, JPG, JPEG) by adding simple checks inside the workflow.
  • Use dynamic folder names based on date or client name to organize optimized images better.
  • Adjust file naming patterns in the upload node for branding or version control.

Troubleshooting Common Problems

Problem: TinyPNG HTTP Request returns 401 Unauthorized

Cause: API Key not correct or missing Base64 encoding.

Fix: Confirm correct API Key, use online Base64 encoding tool to encode “api:key”, then update Authorization header.

Problem: Google Drive Trigger does not detect new files

Cause: Folder ID may be wrong or Google OAuth permission issues.

Fix: Verify Google Drive folder ID matches watched folder and credentials allow file read access.


Pre-Production Checklist

  • Make sure Google OAuth credentials are active and connected in n8n.
  • Test TinyPNG API Key with a request and check it works.
  • Upload a small image to the watched Google Drive folder to trigger the workflow.
  • Look at each node’s log output to confirm data moves as expected.
  • Check optimized images save correctly in the target Google Drive folder.

Deployment Guide

After testing, turn on the workflow switch in the n8n editor to start automation.

The workflow then runs every minute, optimizing new images automatically.

You can check the execution logs anytime to see the status or find errors early.

For users hosting the automation themselves, consider self-host n8n to run workflows on a private server.


Summary

✓ Automatically watches Google Drive for new images.

✓ Compresses images using TinyPNG API to save space and speed sharing.

✓ Uploads smaller images back to a separate folder with clear naming.

→ Saves hours by removing manual compression work.

→ Keeps images ready quickly for clients or collaborators.


Automate image optimization with n8n and Google Drive

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Check that the API Key is correct and properly Base64 encoded. Update the Authorization header with the encoded key.
Ensure the trigger watches the correct folder ID and the Google OAuth credentials have permission to read files.
Yes, replace the HTTP Request nodes with ones calling other APIs like ImageOptim or Kraken.io and adjust parameters accordingly.
Import the workflow in the n8n editor, set credentials and folder IDs, test once, and then activate the workflow switch to run automatically.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.