CLAUDE LABJP
SONNET — Claude Sonnet 5 is now the default model in Claude Code, with a native 1M-token context window and introductory pricing through August 31CHROME — Claude in Chrome reaches general availability, letting you hand browser work directly to ClaudeCOWORK — Cowork expands to mobile and web so sessions and files follow you across devices, starting in beta for Max usersDATAVIZ — Claude Code adds a /dataviz skill offering guidance for designing charts and dashboardsAGENTS — Agent workflows gain background notifications, draft PR handoff, and improved failoverENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alertsSONNET — Claude Sonnet 5 is now the default model in Claude Code, with a native 1M-token context window and introductory pricing through August 31CHROME — Claude in Chrome reaches general availability, letting you hand browser work directly to ClaudeCOWORK — Cowork expands to mobile and web so sessions and files follow you across devices, starting in beta for Max usersDATAVIZ — Claude Code adds a /dataviz skill offering guidance for designing charts and dashboardsAGENTS — Agent workflows gain background notifications, draft PR handoff, and improved failoverENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alerts
Articles/API & SDK
API & SDK/2026-07-11Advanced

Is This New Wallpaper Too Close to One We Already Ship? Near-Duplicate Detection with a Perceptual-Hash Pre-Filter and Claude Vision

A two-stage pipeline that catches the near-duplicates a SHA256 hash misses — recolored, lightly cropped, re-encoded — by pre-filtering with a perceptual hash and adjudicating only the close pairs with Claude Vision. With measured precision calibration and cost design from running a wallpaper catalog solo.

Claude Visionimage processingduplicate detection2perceptual hashcost design2

Premium Article

I was about to add sixty freshly finished wallpapers to the catalog one morning when I stopped scrolling. That blue gradient — I feel like I've shipped something close to it before.

Memory is not reliable. Somewhere in a catalog that had grown to a few thousand images, was there really a near-match, or was I imagining it? For a while I had no way to check, and I published on a quiet "probably fine."

Shipping the same wallpaper twice with only a color change reads as recycling. It costs you a little in the store's impression, and a little in daily trust. This article is about catching the near-duplicates an exact hash never sees — using a perceptual hash and Claude Vision in two stages — with the numbers from running a wallpaper catalog as a solo indie developer.

The morning an exact hash let one slip through

My first move was to compare the raw bytes of each file with SHA256. That is airtight for duplicate files: identical bytes produce identical hashes. I once built a ledger around exactly this idea to clean up duplicates on the Files API (I wrote it up in Deduplicating with content hashes on the Files API).

In the wallpaper workflow, though, it was almost useless. The reason is simple: most of what I perceive as "similar" is, byte for byte, a different file.

OperationAppearanceSHA256
Warm the color balance slightlyNearly identicalChanges completely
Trim a few percent off the edgesNearly identicalChanges completely
Re-encode on export (quality 90 to 85)IdenticalChanges completely
Downscale by 10 percentIdenticalChanges completely

An exact hash returns an unrelated value if even one pixel differs. So the case that troubled me most — looks the same, but slightly different — was precisely the one it could never catch, by design.

What I needed was a tool that measures visual closeness, not byte equality.

Why pair a perceptual hash with Vision

The classic tool for quantifying visual closeness is the perceptual hash. You shrink the image drastically, convert it to grayscale, keep only the light-dark relationships between neighboring pixels, and fold that into 64 bits. Because color tweaks and light compression preserve the light-dark skeleton, similar images produce similar hashes.

A perceptual hash alone was not precise enough, though. Loosen the threshold and you miss fewer duplicates but also pick up unrelated designs that happen to share a composition. Tighten it and you miss the recolored near-duplicates. That band — where loosening and tightening both fail — is exactly the region a human resolves at a glance but a machine struggles with.

So I split the roles. The perceptual hash stays a cheap, fast, high-volume pre-filter for narrowing candidates, and only the final "is this essentially the same?" call goes to Claude Vision. Vision is expensive, but after the narrowing it runs very few times. Earn recall with the cheap filter; recover precision with the expensive judgment. That division of labor is the heart of the design.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Catch the recolored and lightly cropped near-duplicates that an exact SHA256 match lets slip through, using a perceptual hash and Vision in two stages
Cost design that avoids the all-pairs comparison (a perceptual hash trims candidate pairs to about 0.03 percent before Vision) with real precision calibration
An abstain route that sends the gray zone to a human queue, plus a design that avoids flagging legitimate series variations as duplicates
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-07-05
Don't Let the Opus 4.7 Fast Mode Retirement (July 24) Kill Your Unattended Jobs
claude-opus-4-7 fast mode retires on 2026-07-24, and speed: fast starts throwing errors. Here's how to keep unattended pipelines from breaking silently: mechanically detect where fast mode is used, add a fail-closed runtime guard, and migrate to 4.8 with working code.
API & SDK2026-07-11
Tightening Tool Schemas From the Arguments You See in Production
Record the arguments Claude actually passes to your tools in production, then use that distribution to add enums and patterns back into your JSON Schema. With logging code and before/after numbers.
API & SDK2026-07-11
When Whisper Wrote 'Thanks for Watching' Into the Silence — Measuring and Killing Japanese Transcription Hallucinations
Whisper inserts phantom boilerplate into silent or noisy segments of Japanese audio. Here is how to measure hallucinations with no_speech_prob and avg_logprob, strip silence with VAD, and have Claude validate what remains — with the implementation and the routine that pulled it back.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →