# Image catalog - fuzzy match with percent score

This compares the query file against the catalog using a block-level content fingerprint (16 chunks, each chunk hashed separately) and reports what percentage of chunks match. It catches near-duplicates at the byte level (same image re-saved with different metadata, a few edited bytes) - it is not visual similarity/computer-vision matching: a resized, cropped, or recompressed copy of a catalog image will score low or 0%, because compression changes every byte, not just a few chunks. Real visual-similarity matching needs image-decode + perceptual-hash or DNN feature-extraction infrastructure, which is separate, not-yet-built work (see WEBSUPPORT_ICPP_PLAN.md Part 10's ivec_* vector search engine for where that would plug in).

## Catalog

id | filename | size | hash
--- | --- | --- | ---
| ", icpp_sql_get($q,"id"), " | ", icpp_sql_get($q,"filename"), " | ", icpp_sql_get($q,"filesize"), " | ", icpp_sql_get($q,"filehash"), ""); } icpp_sql_free($q); ?>

## Query result

Query file: ", icpp_getparam("query_path"), ""); iprint("

catalog image | percent match
--- | ---
"); $m = icpp_sql_query($db, "select * from image_catalog;"); while(icpp_sql_next($m)) { $pct = icpp_fingerprint_similarity(icpp_file_fingerprint(icpp_getparam("query_path")), icpp_sql_get($m,"fingerprint")); iprint("
", icpp_sql_get($m,"filename"), " | ", $pct, "%
"); } iprint("

"); icpp_sql_free($m); icpp_sql_disconnect($db); ?>