Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 4 min read

A Data-Driven Preflight Check for Marketplace Product Images

Most marketplace image failures are described as visual problems: the crop is wrong, the background is off-white, or a badge is in the wrong place. For an engineering team, they are often contract failures discovered too

Most marketplace image failures are described as visual problems: the crop is wrong, the background is off-white, or a badge is in the wrong place. For an engineering team, they are often contract failures discovered too late.

The upload payload has metadata. The marketplace has rules. The image-processing step has another set of assumptions. When those three systems disagree, someone discovers the mismatch in a seller dashboard after the rest of the batch has already been processed.

A better boundary is a preflight contract: load the marketplace rules as data, check the metadata you can verify mechanically, and return a deterministic result before an image enters the publishing pipeline.

Why hard-coded checks become stale

Marketplace requirements are not static. A platform can change the minimum upload size, clarify which background is accepted, or add a category-specific rule. If those values are scattered across a validation function, a CMS form, and a worker queue, each change creates three places to update.

The useful split is:

  • marketplace: the platform being validated;
  • image type: a main image, lead image, or listing image set;
  • minimum and recommended dimensions;
  • aspect ratio;
  • background expectation;
  • product-fill guidance;
  • text and overlay policy;
  • accepted formats;
  • official source URL and review date.

That schema does not mean every field can be evaluated by code. It means every rule has a place to live and a provenance record.

Start with a source-checked record

For a recent cross-marketplace experiment, I packaged a versioned snapshot as a public dataset. It contains 10 product-image records across nine marketplaces: Amazon, Temu, TikTok Shop, Shopee, Etsy, Walmart, eBay, Google Merchant Center, and Facebook Catalog.

Each record links to an official marketplace source and includes the date the record was reviewed. The snapshot is available under CC BY 4.0:

The important part is not the number of rows. It is the separation between policy data and preflight logic. The data can be reviewed and versioned independently from the application that consumes it.

A minimal preflight implementation

The example below deliberately uses metadata rather than pretending to inspect visual quality:

const spec = dataset.specifications.find(
  (item) => item.marketplace.toLowerCase() === marketplace.toLowerCase()
);

const minimum = parseMinimumSize(spec.minimumSize);
const allowedTypes = acceptedMimeTypes(spec.formats);

const errors = [];

if (width < minimum.width || height < minimum.height) {
  errors.push("Image dimensions are below the recorded minimum.");
}

if (!allowedTypes.includes(mimeType)) {
  errors.push(`Unsupported format: ${mimeType}.`);
}

if (hasOverlay && /no text|no watermark/i.test(spec.textPolicy)) {
  errors.push("The lead image contains a prohibited overlay.");
}

return {
  status: errors.length === 0 ? "pass-with-manual-checks" : "fail",
  errors,
  officialSource: spec.officialSource,
  verifiedAt: spec.verifiedAt
};

The phrase pass-with-manual-checks matters. A metadata validator can reject an undersized JPEG or a clearly forbidden overlay. It cannot know whether the product colour is accurate, whether the item fills 85% of the frame, whether a category has a stricter requirement, or whether a human reviewer will approve the listing.

Returning a false sense of certainty is worse than returning no result.

Separate deterministic failures from human checks

I would use three result states:

  1. Fail: a recorded technical rule was violated.
  2. Pass with manual checks: the metadata is inside the baseline, but visual or category rules still need review.
  3. Unknown: the marketplace or category is not in the current snapshot.

That third state is especially important. A pipeline should not silently fall back to generic rules when a marketplace is missing from the dataset. Silent fallbacks create exactly the kind of inconsistency the preflight contract is meant to prevent.

Keep provenance in the response

Every result should carry the source and review date that produced it. If a seller disputes a rejection, the team can answer four questions:

  • Which marketplace rule was used?
  • Which version of the dataset produced the result?
  • When was that rule last reviewed?
  • Which official page is the source?

This is a better debugging surface than a generic β€œimage rejected” message.

What belongs after the preflight

A practical image pipeline can then split into stages:

metadata preflight
  β†’ visual rule checks
  β†’ category review
  β†’ human approval
  β†’ upload
  β†’ post-upload verification

The preflight layer is cheap and deterministic. It should run before expensive image generation, retouching, or resizing. A 640Γ—640 WebP destined for a marketplace whose recorded baseline requires 800Γ—800 and JPEG/PNG should fail immediately, not after a batch has consumed model credits and storage.

Reproducible source

The source-checked snapshot is available as both JSON and CSV. It accepts marketplace, width, height, MIME type, transparency, and overlay metadata as inputs for a small preflight function, then returns the recorded rule, errors, manual-check warning, official source, and review date:

https://www.aisellerkit.com/marketplace-image-requirements

The example is intentionally narrow. It demonstrates the contract boundary, not a complete image-analysis system.

The engineering lesson

Marketplace compliance is easier to maintain when it is treated as versioned policy data with provenance, not as a collection of conditionals embedded in an upload worker.

A small preflight contract will not guarantee approval. It will, however, make stale rules visible, make failures explainable, and stop metadata errors from travelling farther down the pipeline than necessary.

Disclosure: I am the founder of AISellerKit, which maintains the public dataset linked above. The review dates, official source URLs, and limitations are included so readers can inspect or challenge the records.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.