Skip to content
Back to skills

face-detect

ASecurity

Detect faces in a photo and check their quality, using the SightRadar face recognition API. Use when the user wants to count faces in an image, get face bounding boxes for cropping or blurring, check that an upload has exactly one clear face before using it as a selfie or profile photo, filter out photos with no people, or replace AWS Rekognition DetectFaces. Nothing is stored.

  • 0 votes
  • 0 copies
  • 1 view
  • Added December 5, 2026
ai-agentspythongobashawsapi

Works with

  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 5, 2026

npx -y skills add sightradar-hq/sightradar-skills --skill face-detect --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of face-detect?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for face-detect
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sightradar-hq-face-detect/badge)](https://www.skillsdirectory.com/skills/sightradar-hq-face-detect)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: face-detect
description: Detect faces in a photo and check their quality, using the SightRadar face recognition API. Use when the user wants to count faces in an image, get face bounding boxes for cropping or blurring, check that an upload has exactly one clear face before using it as a selfie or profile photo, filter out photos with no people, or replace AWS Rekognition DetectFaces. Nothing is stored.
license: MIT
compatibility: Needs network access to api.sightradar.com, a SightRadar API key in SIGHTRADAR_API_KEY, and curl.
metadata:
  author: SightRadar team
  version: "1.0.0"
  homepage: https://sightradar.com
---

# Face detect: faces, boxes and quality

`POST https://api.sightradar.com/v1/detect` finds the faces in one image and says which of them are good enough for recognition. The image and the faces are not stored.

## Before you start

- Key: `export SIGHTRADAR_API_KEY="frs_..."` (create one at https://sightradar.com/dashboard/keys). Never print or commit it. If it is missing, ask the user to set it; do not ask them to paste it in chat.
- Cost: 93 credits per image (about $0.0009), with or without faces. Say the total before running over a folder.

## Detect

```bash
B="https://api.sightradar.com"; AUTH="Authorization: Bearer $SIGHTRADAR_API_KEY"

curl -s -X POST "$B/v1/detect" -H "$AUTH" -F "file=@./photo.jpg"                       # local file
curl -s -X POST "$B/v1/detect" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/photo.jpg"}'                                         # public URL
curl -s -X POST "$B/v1/detect" -H "$AUTH" -H "Content-Type: application/octet-stream" \
  --data-binary @./photo.jpg                                                           # raw bytes
```

```json
{
  "detected_face_count": 2,
  "gated_face_count": 1,
  "faces": [
    { "face_index": 0, "det_score": 0.83, "min_px": 174.4, "quality_passed": true,
      "bbox": { "left": 0.52, "top": 0.66, "width": 0.18, "height": 0.31 } }
  ]
}
```

- `detected_face_count`: every face found.
- `gated_face_count`: faces that pass the quality gate, which are the ones indexing and search would use.
- `faces[].bbox`: the face box as fractions of the image width and height (0 to 1), with the EXIF rotation already applied. Pixels: `x = left * image_width`, `y = top * image_height`.
- `faces[].min_px`: the shorter side of the face in pixels. `det_score`: detector confidence, 0 to 1.
- `faces[].quality_passed`: false when the face is too small, blurred, turned away or covered.

Limit 30 MB. JPEG, PNG, WebP, HEIC, TIFF, GIF and BMP are accepted.

## Common checks

| Goal | Rule |
| --- | --- |
| Valid selfie or profile photo | `detected_face_count == 1` and `gated_face_count == 1` |
| Group photo | `detected_face_count > 1` |
| No people | `detected_face_count == 0` |
| Faces present but unusable | `detected_face_count > 0` and `gated_face_count == 0`: ask for a sharper, closer, front-facing photo |

To crop or blur faces, convert each `bbox` to pixels and pass it to the image tool at hand (Pillow, sharp, ImageMagick, ffmpeg). Add a margin of about 20% around the box, because it is tight to the face.

```python
from PIL import Image, ImageFilter, ImageOps
img = ImageOps.exif_transpose(Image.open("photo.jpg"))   # match the orientation the API used
W, H = img.size
for f in faces:                                          # faces = response["faces"]
    b = f["bbox"]
    box = (int(b["left"] * W), int(b["top"] * H), int((b["left"] + b["width"]) * W), int((b["top"] + b["height"]) * H))
    img.paste(img.crop(box).filter(ImageFilter.GaussianBlur(25)), box)
img.save("blurred.jpg")
```

## In code

```python
# pip install sightradar
from sightradar import SightRadar
det = SightRadar().detect(file="photo.jpg")           # reads SIGHTRADAR_API_KEY
print(det.detected_face_count, det.gated_face_count)
```

```ts
// npm install sightradar
import { SightRadar } from "sightradar";
const det = await new SightRadar().detect({ url: "https://example.com/photo.jpg" });
console.log(det.detected_face_count, det.gated_face_count);
```

## What detect does not do

It returns no age, gender, emotion or landmarks, and it does not say who a face is. To match faces, use the `face-compare` skill (two photos) or the `face-search` skill (one person across many photos).

## Errors

400 the image cannot be fetched or decoded (the body says why). 401 bad key. 402 out of credits. 413 image over 30 MB. 429, 502, 503: wait and retry. Failed requests are not charged. Full docs: https://sightradar.com/llms.txt

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.