Live
Image Safety
Check an image against a policy set: uploads, profile photos, product listings, screenshots, or images your AI model generates.
const result = await client.checkImage(buffer, 'uploads', { showReason: true });
switch (result.verdict) {
case 'pass': return store(buffer);
case 'block': return reject(result.reason);
case 'unknown': return sendToHumanReview(buffer);
}
The image can be a file path, a Buffer or a Uint8Array.
Options
| Option | Default | What it does |
|---|---|---|
showReason | false | When true, the result includes reason: what in the image led to the verdict. |
What you get back
verdict | Meaning |
|---|---|
block | The image breaks at least one rule in the set. |
pass | It breaks none. |
unknown | The image couldn't answer the question: too dark, too cropped or too blurry. |
unknown isn't a pass. Send it to a person, or decide what it means for your
product. isSafe(result) is true only for pass.
Examples
Real results, with the reason shown:
block
“Flag if a readable address or licence plate is visible.”
Illinois licence plate clearly legible on the white Nissan van’s front bumper
pass
“Flag if a readable address or licence plate is visible.”
Only small decorative American flags on car; no street sign, address text, or licence plate visible
block
“Flag if a registered trademark (R) or trademark (TM) symbol is legible.”
Small “TM” mark printed after the colorful “FACTORY” wordmark on the right
pass
“Flag if a weapon is being aimed at or used against a person.”
Crowd of protesters with signs and mounted police; no weapon aimed at anyone
Limits
| Formats | JPEG, PNG, GIF, BMP, WebP |
| Size | Up to 20 MB |
See also: Moderating uploads.