POST/image

Compare Images

Compute a visual diff between two images. Supports both multipart/form-data file uploads and JSON with base64-encoded data URLs.

Parameters

emailquerystring

Your email address. Required if not using an API key.

input_typequerystringrequired

Specifies the request content-type. - `form`: multipart/form-data - `json`: application/json

Values: json, form

output_typequerystringrequired

Specifies the type of output you receive in the response body. - `json`: Same PNG you see on the Diffchecker site for image diffs, but embedded in JSON as a data URL (Content-Type: application/json) - `png`: Same PNG you see on the Diffchecker site for image diffs (Content-Type: image/png)

Values: json, png

Request Bodyrequired

left_imagestring (binary)required

Left image file you want to diff. Accepted file extensions include .png, .jpg, .jpeg.

right_imagestring (binary)required

Right image file you want to diff. Accepted file extensions include .png, .jpg, .jpeg.

Responses

Diff computed successfully.

application/json

dataUrlstring

Data URL of the diff image (PNG).

diffPixelsinteger

Number of pixels that differ.

totalPixelsinteger

Total number of pixels compared.

misMatchPercentagenumber (float)

Percentage of pixels that differ.

widthinteger
heightinteger
originalWidthinteger
originalHeightinteger
changedWidthinteger
changedHeightinteger
Example
{
  "dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABVAAAAS8CAYAAABqj6EYAAAABmJLR0QA...",
  "diffPixels": 34651,
  "totalPixels": 234600,
  "misMatchPercentage": 14.77,
  "width": 460,
  "height": 510,
  "originalWidth": 452,
  "originalHeight": 477,
  "changedWidth": 460,
  "changedHeight": 510
}

image/png

string (binary)

Example Request

curl
curl -X POST \
  "https://api.diffchecker.com/public/image?email=your%40email.com&input_type=json&output_type=json" \
  -H "Content-Type: application/json" \
  -d '{
  "left_image": "{left_image}",
  "right_image": "{right_image}"
}'

Try It