Zip EPS and JPG Pairs for Stock Uploads (Free Script)
Free Python script that puts each EPS vector and its matching JPG preview into one ZIP file, ready for stock site and marketplace uploads.
Download zip-eps-jpg-pairs.pyPython 3 · 62 lines · 2 KB · free
Vector files are often delivered as a pair: the EPS and a JPG preview with the same name, packed into one ZIP. Adobe Stock accepts vectors this way, and many marketplaces and clients ask for the same. Zipping fifty pairs by hand is tedious and easy to get wrong. This script does it in a second.
What it does
- Looks in one folder for
.epsand.jpgfiles that share a name - Makes one ZIP per pair, named after the files:
icon-set.epsandicon-set.jpgbecomeicon-set.zip - Leaves the original files where they are
- Skips a pair if its ZIP already exists
- Ignores an EPS that has no JPG, and the other way round
How to use it
- Put your EPS files and their JPG previews in one folder. Each pair must have exactly the same name.
- Run the script (see below).
- When it asks for the folder path, paste it, or drag the folder into the terminal window, and press Enter.
- The ZIP files appear in the same folder.
You can also give the folder on the command line: python zip-eps-jpg-pairs.py "C:\Stock\Batch 12".
How to run a Python script
- Install Python 3 from python.org if you do not have it. It is free. On Windows, tick Add Python to PATH in the installer.
- Download the script with the button on this page and save it somewhere easy, such as your Desktop.
- Open a terminal. On Windows, press the Windows key, type
cmdand press Enter. On Mac, open Terminal from Applications > Utilities. - Type
pythonfollowed by a space (on Mac,python3and a space), drag the script file into the terminal window and press Enter.
Making the JPG previews
If you only have the EPS files, the EPS to JPG script for Illustrator exports a JPG for every EPS in a folder, with matching names. Run it first, then this one.
Questions
Does it work with AI files instead of EPS?
Not as written. Open the script in a text editor and change ".eps" to ".ai" in the line that collects the vector files.
Why did it say "No matching pairs found"?
The names must match exactly apart from the extension. icon set.eps and icon-set.jpg are not a pair. Preview files ending in .jpeg are not picked up either. Rename them to .jpg.
Do stock sites need the files zipped?
It depends on the site, and the rules change. Check the current upload guidelines of the site you are submitting to.
The code
This is the complete script. Nothing else is downloaded or installed.
"""Zip EPS and JPG pairs
For every EPS file that has a JPG with the same name, makes one ZIP holding both:
"icon-set.eps" + "icon-set.jpg" become "icon-set.zip".
Free script from LinearAndLoom Icons: https://linearandloomicons.netlify.app/scripts/
Provided as is. Renaming and zipping cannot be undone, so try it on a copy of your folder first.
"""
import os
import zipfile
from pathlib import Path
def zip_eps_jpg_pairs(folder_path):
"""
For each pair of .eps and .jpg files with the same base name in `folder_path`,
create a ZIP archive containing both files. The archive is named after the base name
and placed in the same folder.
"""
folder = Path(folder_path).resolve()
if not folder.is_dir():
print(f"Error: '{folder_path}' is not a valid directory.")
return
# Collect all .eps and .jpg files
# Extensions are matched in any letter case (.eps, .EPS, .jpg, .JPG)
eps_files = {f.stem: f for f in folder.iterdir() if f.is_file() and f.suffix.lower() == ".eps"}
jpg_files = {f.stem: f for f in folder.iterdir() if f.is_file() and f.suffix.lower() == ".jpg"}
# Find common base names (files that exist in both formats)
common_stems = set(eps_files.keys()) & set(jpg_files.keys())
if not common_stems:
print("No matching .eps / .jpg pairs found.")
return
for stem in sorted(common_stems):
eps_path = eps_files[stem]
jpg_path = jpg_files[stem]
zip_path = folder / f"{stem}.zip"
# Skip if ZIP already exists (optional: ask to overwrite)
if zip_path.exists():
print(f"Warning: {zip_path.name} already exists. Skipping {stem}.")
continue
try:
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zf:
# Add both files, using their original names inside the archive
zf.write(eps_path, arcname=eps_path.name)
zf.write(jpg_path, arcname=jpg_path.name)
print(f"Created: {zip_path.name}")
except Exception as e:
print(f"Failed to create ZIP for {stem}: {e}")
if __name__ == "__main__":
import sys
# Get folder from command line argument, or ask interactively
if len(sys.argv) > 1:
target_folder = sys.argv[1]
else:
target_folder = input("Enter folder path containing .eps and .jpg files: ").strip().strip('"').strip("'")
zip_eps_jpg_pairs(target_folder)Download zip-eps-jpg-pairs.pyPython 3 · 62 lines · 2 KB · free
These scripts are free. If one saved you time, you can say thanks by buying a pack from the LinearAndLoom Etsy shop.


