Free BASH Shopify Product Media SEO AI Image OptimizerFree BASH Product Image Optimizer

Topic summary

A developer created an open-source BASH tool to automate SEO optimization for Shopify product images, addressing a real-world challenge encountered while working with a Miami perfume shop’s online store.

The Problem:

  • Over 700 product images had poor technical SEO: generic filenames (like “IMG_S3932.JPG”), missing/incorrect ALT text, wrong dimensions, large file sizes, and suboptimal formats
  • Google’s algorithm struggles to associate poorly-named images with products, reducing SERP visibility

SEO Best Practices Highlighted:

  • Use descriptive filenames (e.g., “Alhambra-Yeah-Man-perfume-online-and-in-miami.webp”)
  • Separate words with dashes (-), not underscores or spaces, as search crawlers only recognize dashes as word separators
  • Optimize image dimensions, compression, and format (WEBP recommended)

The Solution:
The tool leverages Shopify’s GraphQL API and Gemini AI to:

  • Bulk download product images while preserving upload order
  • Automatically rename files and generate ALT text
  • Resize, compress, and convert images to WEBP format
  • Re-upload optimized media to products

The GitHub repository is publicly available for others facing similar Shopify image optimization challenges.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

Around March of this year I had the need to accomplish a daunting task. I was looking for clients when I ran into JeanSmellGood.com’s website and physical store. Jean owns a perfume shop in the Miami Gardens/Hialeah area here in South Florida. JeanSmellGood.com’s website is a Shopify store that sells perfumes. His passion for perfumes is one of devotion and knowledge. When I arrived at his store, Jean recognized that as passionate as he is about perfumes, I’m also just as passionate about computers. Jean gave me the opportunity to work on his Shopify store. Specifically, my initial proposal consisted of ways in which to improve JeanSmellGood.com’s SEO.

GitHub Repository:
TopMiamiSoftware Shopify Product Media SEO AI Optimizer – AI Rename, Add ALT text, Resize, Compress, Convert to WEBP

Initial SEO Audit & Incorrect Technical SEO for Image Files

So I conducted the usual SEO analysis, and from there on out, ideas started bursting out. One of the many tasks I had to take care of was renaming over 700 images that were uploaded with incorrect technical SEO standards. What does this mean? Incorrect technical SEO for images is based on the following; incorrectly named images, incorrect or missing ALT text for images, wrong image dimensions, bloated image size, wrong image formats.

Why should you optimize your Shopify Product Media files correctly?

Following Google’s SEO naming conventions is vital for a good placement of your Shopify Products in the Search Engine Result Pages (SERPs). Here is the deal, if you index something as a perfume bottle image with the following url name convention “IMG_S3932.JPG”, there are less chances that Google will associate your image with that product. This is because URLs are a part of the algorithm which associate users’ queries to what is actually in the image. Meaning if the user was looking up “Shop for Maison Alhambra – Yeah! Man in Miami”, there will be less chances of your image showing up than one that was indexed correctly with the “Shop-for-Maison Alhambra-Yeah-Man-perfume-online-and-in-miami.webp” file URL. As you can see, the user’s query: “Shop for Maison Alhambra – Yeah! Man in Miami” appears right in the URL of “Shop-for-Maison Alhambra-Yeah-Man-perfume-online-and-in-miami.webp”. That would be a correct image file naming tactic. The strategy is to get all the technical SEO aspects of your image files correct. Now your image is indexed as “Shop-for-Maison Alhambra-Yeah-Man-perfume-online-and-in-miami.webp”, a direct description of what is in the image itself. Along with this, another image file naming tactic is to only use dashes, – to separate words within your image file names. This is because words are split using dashes “-” and not underscores “_” or spaces. As a matter of fact, search engine crawlers will not recognize separate words unless they are separated by dashes. Now you know how to correctly name file images in your Shopify store or any other website.

The Solution - Use Shopify GraphQL & Gemini AI to SEO Optimize Images

To fix this issue with a Shopify Store’s product media, you first need to download all the product images. Along with downloading the images, one also needs to rename them in an efficient manner which would not include them sitting there and checking the name of each product, manually renaming files. Same goes for the ALT text, you want to take care of that automatically. Additionally, the product images need to be downloaded locally in a manner in which they can then be re-uploaded to the product in the same order in which they were first uploaded to the product.

1 Like

Hey @franco_go,

Thanks for sharing the useful tips. But I have a Question. If there are 100 products and each one has 10 images. Let we download them all and fix the issue with the alt and set the seo friendly name for the images.

After that we need to upload the images manually one by one.

To be honest this is not looking a easy way instead we can open the image in the Admin and add the name along with the alt text.

Best,

Liam Scott.

2 Likes

I would just go with an app to be honest. Quite a lot of cheap apps out there which can get great results for image optimization, filenames and ALT texts

1 Like

I always name my images when I save them in photoshop so I don’t have to go through that mess. So far Shopify keeps the filename but just adds some numbers.

Thanks, it is interesting approach.

IMO, there is no need to convert image files to WEBP – this happens automatically in most cases and even though the file name stays XXX.jpg, it’s served as WEBP.

But otherwise this may make sense for a dev tasked to amend all the images without using an 3rd party app, though IMO it would be better to get an app to rename images and drop it after initial renaming is done.
Then follow the guidelines during image creation stage.

There is a whole bunch of apps to do exactly that.

The question though – how many products and images in total were processed? Were there any throttling problems and how they were handled other than

    # Let's not overwhelm the API
    sleep 4

which makes is 900/hour and ~20K images per day…

1 Like

It’s an interesting question. :sweat_smile:

The other throttling problem I had wasn’t really a throttling problem. It had to do with the amount of results that the GraphQL returns from the products query. So, since the GraphQL return limit is 250 products, if you have more than 250 products, then the script gets the last product cursor from the previous query and resumes querying products using that cursor.

1 Like

Hey @franco_go
Really cool project , optimizing Shopify product media can make a huge difference in SEO and site speed. You’re absolutely right that filenames, ALT text, and image formats play a big role in how Google indexes product pages.

One thing I’ve found helpful is automating this process directly through Shopify’s GraphQL API , you can bulk rename and update ALT text without manually re-uploading every image. Pairing that with AI-based keyword generation or a bulk optimizer script can save hours while keeping filenames aligned with search intent.

If you’re still refining your setup, I can share a simple workflow or script that handles this efficiently without breaking existing product associations.

1 Like

Hello! After reading your comment, I was inspired to write a review for the free version of the Avada SEO plugin!

I knew there were apps that accomplished a version of this already, however the reason why I wrote this script was because I did not find anything that fit my use case specifically at the time (back in March 2025). What I wanted was to rename images using AI so that I could rely on maximum specificity. I did not want to only rely on variables that the Shopify store could provide (Product titles, collection names, store name, locations, etc.) Instead I wanted a more specific approach, that’s why I went with the Gemini API. I also did not want to pay for anything. Since this will always be a free open source project, stores all around the world can rely on it to update their Shopify product media!

Here is the review I wrote for the Avada SEO plugin!

Thank you for sharing your feedback!