K
Docs
API Reference→Pieces→Read an Image
🔍

Read an Image

img.inspectThe DarkroomImages

Looks at an image and tells your flow about it: width, height, format, whether it's animated, its dominant colour, a 5-colour palette and how bright it is. Branches on whether it's an image at all — perfect for validating uploads.

When to use this
  • →{{info.isDark}} tells you whether white or black text reads better on top

On the canvas

This is what Read an Image looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

🔍
Read an Image
img.inspect
Images
imagerequired
image…
as
info
image
not_image

Config fields

FieldTypeReqWhat it does
imageimageyesImage 🖼️
as
info
text—Save it as ✨

Output ports

imageRead it — details are in your spark
not_imageEmpty, unreadable, or not a picture
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
const { width, height } = image;
// Dominant colour: sample a small copy and count colour buckets
const tiny = createCanvas(64, 64);
tiny.getContext("2d").drawImage(image, 0, 0, 64, 64);
const pixels = tiny.getContext("2d").getImageData(0, 0, 64, 64).data;
// …bucket, sort, take the biggest → "#e11d48"