/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
Every response includes the X-Credits-Used header. In JSON responses, the same value is also available in the creditsUsed field.
Diff computed successfully.
application/json
creditsUsedintegerrequiredCredits charged for the diff request.
dataUrlstringrequiredData URL of the diff image (PNG).
diffPixelsintegerrequiredNumber of pixels that differ.
totalPixelsintegerrequiredTotal number of pixels compared.
misMatchPercentagenumber (float)requiredPercentage of pixels that differ.
widthintegerrequiredheightintegerrequiredoriginalWidthintegerrequiredoriginalHeightintegerrequiredchangedWidthintegerrequiredchangedHeightintegerrequiredExample
{
"creditsUsed": 1,
"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://web.preview.diffchecker.com/api/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}"
}'