×720 Or 600×600: How Pack_Product.py Renders Both Covers And Thumbnails With Pillow

First upload bounced. Not for art quality. For cover size. Marketplace wanted 1280×720. I sent 1920×1080. Robot reject. No human looked at it. Fixed size, resubmitted, sold first product same week. Digital Asset Factory, $2.80. Lesson stuck: packaging is not decoration. It is a rule check that runs before a human ever sees your work.

pack_product.py exists because that reject cost me a day. Script does two things: zips product files, then renders two images with Pillow. Cover at 1280×720. Thumbnail at 600×600. Same source, two crops, zero manual export. Here is what actually works.

Why two sizes exist

Marketplaces split product display into two surfaces. Cover sits on product page, wide banner, 16:9. Thumbnail sits in search results and category grids, square. One image cannot serve both. A 16:9 image squeezed into a square looks broken. A square image stretched to 16:9 looks amateur. Buyers scroll search grids fast. Bad thumbnail means no click. No click means no sale.

So script renders both from one source file. Pillow handles resize and crop. No Photoshop, no manual export, no remembering which marketplace wants which size this week.

The crop logic that saves the composition

Naive resize distorts. Stretch a 4000×3000 source to 1280×720 and everything goes wide and wrong. Script avoids this with center crop before resize.

Workflow per image:

  1. Open source with Image.open().
  2. Convert to RGB. Pillow opens some files in palette or CMYK mode. JPEG output requires RGB. Skip this and save fails silently on certain PNGs.
  3. Compute target aspect ratio. For cover, 1280/720 = 1.777. For thumbnail, 1.0.
  4. Crop source to match target ratio, centered. This cuts edges, never distorts.
  5. Resize cropped region to exact target dimensions with Image.LANCZOS.
  6. Save as JPEG, quality 90.

Quality 90 matters. Higher wastes bytes. Lower shows compression artifacts on flat vector colors, which is exactly what stock art buyers notice. 90 is the sweet spot where file size stays small and banding stays invisible.

The memory habit that keeps a 2 GB server alive

This pipeline ran on 1 vCPU, 2 GB RAM, no GPU. A 4000×3000 RGBA image is about 48 MB in memory. Open five in parallel and the server swaps, then dies. Script never opens more than one image at a time. Each render finishes, file closes, memory returns.

Two habits enforce this:

  • gc.collect() after each asset. Python does not always return memory to the OS immediately. Forcing collection keeps peak RSS low.
  • Measure peak, not average. resource.getrusage(resource.RUSAGE_SELF).ru_maxrss shows the real ceiling. Average RSS hides the spike that kills the process.

Heavy render steps run one file per subprocess. Subprocess exits, OS reclaims everything. No leak accumulation across thousands of assets.

What the zip step does that a manual zip does not

pack_product.py bundles product files into a zip after rendering covers. Manual zipping has failure modes: wrong root folder, hidden macOS files, thumbs.db, stray temp files. Marketplace reviewers see a zip with __MACOSX/ inside and flag it. Script zips only the files you point it at, no hidden metadata, no nested folders.

Output lands in _system/ next to where the script runs. Point it elsewhere with --dir or PACK_ROOT environment variable. No editing the script for each product.

The real cost of getting this wrong

Every marketplace has an upload queue. Adobe Stock review is not instant. Vecteezy review is not instant. Dreamstime review is not instant. Submit wrong cover size, wait days, get reject, fix, resubmit, wait again. One bad export costs a week of shelf time. Shelf time is lost sales. Script removes that entire failure class.

The metadata side has the same property. make_metadata.py writes exact Adobe 5-column headers, Vecteezy 4-column, Dreamstime 15-column. Wrong header is an instant machine reject. No human reads a CSV with a wrong header. The script removes that failure class too. upload_tracker.py removes the double-post failure class. Same philosophy across the whole kit: automate the boring rule checks so the creative work is the only thing left.

What I would tell a maker starting now

Do not build the full pipeline first. Build the packaging script first. It is the smallest piece that produces a sellable artifact. One source folder in, one zip and two images out. That alone takes you from "I made art" to "I have a product". Metadata and tracking come after, once you have products to submit.

The full kit that this script came from is the Digital Asset Factory. Four standalone Python scripts, no framework, two third-party packages total. Pillow for covers, reportlab for PDF output. The other two scripts use standard library only. It packaged 39 products, 856 MB of output, validated on a single-core 2 GB box.

Get digital asset factory

Building digital products? Free guides & kits for digital product sellers.