read images
read images, table source
table Images = read images "path" creates one row per
filepack (.fp) entry.
The pack must already exist in the account; see
store product images in filepacks.
The path must be constant text. Wildcards match pack paths, not entry paths.
Use read images (path) for a const variable, or text interpolation.
The columns are fixed; a with block is not accepted. Table options follow
the table read statement syntax; use
table Images min 0 = read images "empty.fp" to allow an empty pack.
Columns
| Column | Type | Meaning |
|---|---|---|
FileName |
text | Relative entry path, including subdirectories. |
Hash |
text | MD5 hash of the original image bytes. |
Size |
number | Original file size in bytes. |
Width, Height |
number | Original dimensions in pixels, before EXIF orientation. |
ClassToken |
embedding | Descriptor of the whole image. |
PatchMean |
embedding | Mean of the image’s patch descriptors. |
Both embeddings contain 384 components normalized to unit length.
Compare the same descriptor across images with
similarity. These descriptors are not comparable
to text embeddings produced by embedding.
Examples
List the dimensions of images in an existing pack:
table Images = read images "/catalog/images.fp"
show table "Image dimensions" with
Images.FileName
Images.Width
Images.Height
Compare the pack’s images to its item.png entry, which must exist:
table Images = read images "/catalog/images.fp"
reference = single(Images.ClassToken) when (Images.FileName == "item.png") default fail
show table "Visual similarity to item.png" with
Images.FileName
similarity(Images.ClassToken, reference) as "Similarity"
Higher scores indicate greater visual similarity.
Loading and limits
Only used columns are loaded. Reading FileName, Hash and Size uses the
pack’s index alone. Dimensions inspect image headers; embeddings decode
images and run the model.
Image processing supports still JPEG, PNG and WebP, up to 64 MiB per image, 40 million pixels and 32,768 pixels per dimension. Invalid or missing images fail the read when their dimensions or embeddings are requested.
Image contents must be stored in the same account as the pack. Copying or
sharing the .fp file alone does not copy its images.