Skip to main content
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​

OptionDefaultWhat it does
showReasonfalseWhen true, the result includes reason: what in the image led to the verdict.

What you get back​

verdictMeaning
blockThe image breaks at least one rule in the set.
passIt breaks none.
unknownThe 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​

FormatsJPEG, PNG, GIF, BMP, WebP
SizeUp to 20 MB

See also: Moderating uploads.