/imageCompare Images
Compute a visual diff between two images. Supports both multipart/form-data file uploads and JSON with base64-encoded data URLs.
Parameters
emailquerystringYour email address. Required if not using an API key.
input_typequerystringrequiredSpecifies the request content-type. - `form`: multipart/form-data - `json`: application/json
Values: json, form
output_typequerystringrequiredSpecifies 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)requiredLeft image file you want to diff. Accepted file extensions include .png, .jpg, .jpeg.
right_imagestring (binary)requiredRight image file you want to diff. Accepted file extensions include .png, .jpg, .jpeg.
Responses
Diff computed successfully.
application/json
dataUrlstringData URL of the diff image (PNG).
diffPixelsintegerNumber of pixels that differ.
totalPixelsintegerTotal number of pixels compared.
misMatchPercentagenumber (float)Percentage of pixels that differ.
widthintegerheightintegeroriginalWidthintegeroriginalHeightintegerchangedWidthintegerchangedHeightintegerExample
{
"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 -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}"
}'