Davix H2I has dedicated tools that compare two versions of a file and tell you what changed. Use them to check a result against the original, or one revision against the next.
Pick the compare tool that fits
| Your files | Tool | What you get |
|---|---|---|
| Two pictures | Compare images | How different they are and where, including the share of differing pixels and a similarity score |
| Two renders, before and after a change | Visual check | A pixel-by-pixel comparison with the changed areas marked |
| Two PDFs | Compare PDFs | A line-level text difference or a per-page visual difference |
| Two documents of any kind (Word, PDF, Excel, text) | Compare documents | What was added and removed, a similarity score and the list of changes |
| Two data files | Compare data files | Rows added, removed or changed, with the old and new value of each changed field |
How to run one in Studio
- Open the compare tool in the Workspace.
- Add the two files you want to compare, in the order the tool asks for them.
- Press Generate and read the report. Open picture or PDF results in the viewer to look closer.
Checking a result you just made
Every result is kept in History. To compare it with the original, download both and run the compare tool for that kind of file. The Assistant can also compare two files when you tag them in the chat.
Comparing runs like any other tool, so it uses your allowance in the same way. See Understand usage and limits.
Try it in your language
Choose a tool and a language. The parameters are filled in for you and always match the current API.
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/images/compare" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'imageA=@photo.jpg' \
-F 'imageB=@photo.jpg' \
-F 'threshold=0.1' \
-F 'alpha=0.1' \
-F 'max_diff_ratio=0'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.compare({
"imageA": 'photo.jpg',
"imageB": 'photo.jpg',
"threshold": 0.1,
"alpha": 0.1,
"max_diff_ratio": 0
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->compare([
'imageA' => 'photo.jpg',
'imageB' => 'photo.jpg',
'threshold' => 0.1,
'alpha' => 0.1,
'max_diff_ratio' => 0,
]);
echo $result->requestId;Checked against the API contract 3.0.0 descriptions of these tools.
