Shopify Automation2026-06-26

[Shopify] Eliminate Manual Image Editing! Automated Process from Upload to Resize and CDN Delivery


The Gritty Manual Labor of Image Processing Plaguing E-commerce Operators

"Product images" significantly dictate the sales of an E-commerce site. However, when listing new products or posting images provided by suppliers, the following gritty manual tasks are continuously repeated in the back office:

  1. Manual Image Cropping and Resizing: Cropping the background of images, adjusting the aspect ratio to a square (1:1), and downscaling the size for web display.
  2. Manual File Renaming: Changing meaningless names like IMG_48291.jpg to SEO-friendly names like leather-wallet-brown-01.jpg based on the product model or name.
  3. Individual Uploads to Shopify: Manually dragging and dropping images one by one from Shopify's media management screen and linking them to each product page.

These tasks increase exponentially in required time as the number of products and variations (colors, sizes) grows, heavily pressuring the operator's time. Furthermore, this leads to inconsistencies in image margins and quality depending on the worker.

By combining the Shopify API, an image processing library (Sharp), and cloud storage, you can build a fully automated (Touchless) image pipeline where "simply dropping the original image into a dedicated folder automatically crops, compresses, renames, and reflects it on Shopify."


2. Before & After: Resolving Operational Bottlenecks

Item Manual Image Editing & Uploading (Before) Automated Image Processing Pipeline (After)
Processing Time 3 to 5 minutes per image (manual editing) A few seconds per image (automated processing)
Quality Uniformity Inconsistent sizes and margins depending on the editor Margins and ratios are perfectly standardized via programmatic definitions
File Naming Frequent unedited names and duplicates due to copy-paste omissions Automatically generated based on product SKU and title for SEO friendliness
Capacity Optimization Uploading heavy images slows down page load speeds Automatically compressed into next-gen image formats (WebP/AVIF)

3. Implementation Example: Image Processing and Shopify Registration using Node.js and Sharp

Below is an implementation example of a process that automatically detects images saved in a specific shared folder (like Google Drive), resizes them, and links them via the Shopify API.

import { NextResponse } from "next/server";
import sharp from "sharp";

// Shopify Admin API Credentials
const SHOPIFY_ADMIN_API_URL = `https://${process.env.SHOPIFY_DOMAIN}/admin/api/2024-01`;
const ACCESS_TOKEN = process.env.SHOPIFY_ACCESS_TOKEN!;

export async function processAndUploadProductImage(
  imageBuffer: Buffer,
  productSku: string,
  index: number
) {
  try {
    // 1. Use sharp to resize the image to a square (1000x1000) and convert/compress to WebP format
    const processedImageBuffer = await sharp(imageBuffer)
      .resize(1000, 1000, {
        fit: "contain",
        background: { r: 255, g: 255, b: 255, alpha: 1 }, // Fill background with white
      })
      .webp({ quality: 80 })
      .toBuffer();

    // 2. Create an SEO-optimized filename (e.g., product-sku-01.webp)
    const fileName = `${productSku.toLowerCase()}-${String(index).padStart(2, "0")}.webp`;

    // 3. Upload the image using the Shopify Files API or GraphQL
    // * The following demonstrates linking via the Product Images API (REST)
    const base64Image = processedImageBuffer.toString("base64");
    const response = await fetch(`${SHOPIFY_ADMIN_API_URL}/products/${process.env.TARGET_PRODUCT_ID}/images.json`, {
      method: "POST",
      headers: {
        "X-Shopify-Access-Token": ACCESS_TOKEN,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        image: {
          attachment: base64Image,
          filename: fileName,
        },
      }),
    });

    if (!response.ok) {
      throw new Error(`Shopify Image Upload failed: ${await response.text()}`);
    }

    const data = await response.json();
    console.log(`Image registered successfully. URL: ${data.image.src}`);
    return { success: true, url: data.image.src };
  } catch (error) {
    console.error("Image pipeline failed:", error);
    return { success: false, error: (error as Error).message };
  }
}

4. HadayaLab's E-Commerce Media Automation Solutions

At HadayaLab, we offer creative operations BPR services that dramatically reduce the time retail businesses spend managing product images and promotional banners.

  • Automated Image Cleansing: Integrates with background removal AI to automatically extract only the product and composite it onto brand-defined backgrounds.
  • Bulk Automated Renaming & Placement: Centrally processes and renames massive batches of images from suppliers by linking them to predefined master data.
  • Automated Multi-Mall Image Optimization: Automatically generates and routes images tailored to specific marketplace restrictions (e.g., text ratio limits or white backgrounds for Rakuten) versus Shopify.

If you are a store owner wishing to be freed from the repetitive resizing and cropping tasks required every time you register a product, please consult HadayaLab about our image processing automation plans.

Get Your Free Workflow Audit