Image Diff API
Last Revised: September 18th, 2024
Usage
POST https://api.staging.diffchecker.com/public/image
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| input_type | string | query | Specifies the request content-type. Value must be one of 'json' or 'form'. - json: application/json - form: multipart/form-data | |
| output_type | string | query | Specifies the type of output you receive in the response body. Value must be one of 'json' or 'png'. - json: (Content-Type: application/json) Same PNG you see on Diffchecker site for image diffs, but embedded in JSON as a data url - png: (Content-Type: image/png) Same PNG you see on Diffchecker site for image diffs | |
| left_image | file or string | body | If input_type=json: string containing data url of left image you want to diff (link) If input_type=form: file of left image you want to diff. Accepted file extensions include .png, .jpg, .jpeg | |
| right_image | file or string | body | If input_type=json: string containing data url of right image you want to diff (link) If input_type=form: file of right image you want to diff. Accepted file extensions include .png, .jpg, .jpeg |
Examples
Form Input:
curl --location --request POST 'https://api.staging.diffchecker.com/public/image?input_type=form&output_type=png&email=YOUR_EMAIL' \
--form 'left_image=@"/Users/user_name/Documents/example-1.png"' \
--form 'right_image=@"/Users/user_name/Documentsr/example-2.png"'
JSON Input:
curl --location --request POST 'https://api.staging.diffchecker.com/public/image?input_type=json&output_type=png&email=YOUR_EMAIL' \
--header 'Content-Type: application/json' \
--data-raw '{
"left_image": <left image data url>,
"right_image": <right image data url>,
}'
JSON Responses
output_type=json
{
"dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABVAAAAS8CAYAAABqj6EFAAAABmJLR0QA/wD/AP..."
}