Photo Redactor

Photo Redactor API

Design

Black out or pixelate parts of a photo or screenshot with rectangles, circles and a brush, then copy or download the result. Everything happens in your browser.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

20 requests per minute

Endpoints

1 endpoint available

Overview

Redacts areas of a photo: each region (a rectangle or ellipse) is covered with a solid colour or pixelated, and the result is flattened into a new PNG, so nothing underneath survives. It uses the same rendering code as the web page.

Regions

  • regions is a JSON array of up to 200 objects: {"x": 120, "y": 80, "w": 300, "h": 60, "shape": "rect"}. x and y are the top-left corner and w and h the size, in pixels of the photo as it is displayed (after EXIF rotation). shape is rect (default) or ellipse, which fills the ellipse inside that box.
  • Regions may run past the photo's edges, but each must overlap the photo.
  • With invert=true, the whole photo is redacted except the regions.

Limits and behavior

  • Send multipart/form-data with the photo in the file field: JPEG, PNG, WebP, GIF (first frame), AVIF or TIFF, up to 20 MB and 16 megapixels. HEIC is not supported. The photo is never resized.
  • style=pixelate keeps rough colours. For text, numbers and faces, a solid colour is the safest choice.
  • The output PNG carries no EXIF or other metadata from the original.
  • The response body is the PNG itself, named <name>-redacted.png. Errors are JSON: {"success": false, "error": "..."}. Photos are not stored.

Endpoints

POST
https://opentools.ca/api/v1/tools/photo-redactor
Cover or pixelate regions of a photo and return a flattened PNG

Request Body

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
file
file
Required
The photo. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 20 MB and 16 megapixels.
regions
string (JSON)
Required
JSON array of 1-200 regions: {"x", "y", "w", "h", "shape"} in photo pixels. shape is "rect" (default) or "ellipse".
style
string
Enum: solid, pixelate
OptionalCover with a solid colour, or pixelate.Default: solid
colour
string
OptionalHex colour for style=solid.Default: #000000
block
number
OptionalPixel block size for style=pixelate, 4-1000. Defaults to the longest edge / 50 (at least 8).
invert
boolean
Optional"true" redacts everything except the regions.Default: false

Response Example

The body is the redacted image (Content-Type: image/png), sent as an attachment named "<photo name>-redacted.png". Errors return JSON, for example:
{
  "success": false,
  "error": "Region 2 lies outside the 1200 x 800 photo. Coordinates are in pixels from the top-left corner."
}

Error Codes

400
Bad Request - No file, invalid or out-of-bounds regions, an invalid option, or an image that could not be read or is over 16 megapixels
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key inactive, expired, or not allowed from this IP
413
Payload Too Large - The file is over 20 MB
415
Unsupported Media Type - The file is not a JPEG, PNG, WebP, GIF, AVIF or TIFF image
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/photo-redactor \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@receipt.jpg" \
  -F 'regions=[{"x":40,"y":610,"w":520,"h":48},{"x":300,"y":120,"w":160,"h":160,"shape":"ellipse"}]' \
  -F "style=solid" \
  -F "colour=#000000" \
  -o receipt-redacted.png

Ready to get started?

Create an API key to start using the Photo Redactor API.

Rather use it in your browser? Open the Photo Redactor