Visual Compare
==============
## Installation
```commandline
pip install visual-compare
```
## Examples
### Compare images ###
```python
from visual_compare.doc.visual import Visual
def get_path(filename):
image_base = '../../files/images/'
return image_base + filename
reference_image = get_path('123.png')
test_image = get_path('124.png')
vt = Visual()
is_diff, res = vt.compare_images(reference_image, test_image)
print(res)
assert is_diff is True
```
Result as follows
![1.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/1.jpg)
### Compare images with mask ###
```python
from visual_compare.doc.visual import Visual
def get_path(filename):
image_base = '../../files/images/'
return image_base + filename
reference_image = get_path('123.png')
test_image = get_path('124.png')
mask_images = [get_path('000.png')]
vt = Visual()
mask = vt.generate_mask(reference_image, mask_images)
is_diff, res = vt.compare_images(reference_image, test_image, mask=mask)
print(res)
assert is_diff is True
```
Result as follows
![2.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/2.jpg)
### Compare images with OCR ###
```python
from visual_compare.doc.visual import Visual
def get_path(filename):
image_base = '../../files/images/'
return image_base + filename
reference_image = get_path('123.png')
test_image = get_path('124.png')
vt = Visual()
is_diff, res = vt.compare_images(reference_image, test_image, force_ocr=True, lang=['ch_sim', 'en'])
print(res)
assert is_diff is True
```
Result as follows
![3.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/3.jpg)
Raw data
{
"_id": null,
"home_page": "https://github.com/cuidingyong/visual-compare",
"name": "visual-compare",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "visual compare image pdf diff",
"author": "Dillon",
"author_email": "cuidingyong@yeah.net",
"download_url": "https://files.pythonhosted.org/packages/8f/59/6b5110e33d50bacb399f2923cd3ad8761b7a478e5d4d9a760f2cd47677d6/visual-compare-1.0.2.3.tar.gz",
"platform": null,
"description": "Visual Compare\n==============\n\n## Installation\n\n```commandline\npip install visual-compare\n```\n\n## Examples\n\n### Compare images ###\n\n```python\nfrom visual_compare.doc.visual import Visual\n\ndef get_path(filename):\n image_base = '../../files/images/'\n return image_base + filename\n\nreference_image = get_path('123.png')\ntest_image = get_path('124.png')\nvt = Visual()\nis_diff, res = vt.compare_images(reference_image, test_image)\nprint(res)\nassert is_diff is True\n```\n\n Result as follows\n\n![1.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/1.jpg)\n\n### Compare images with mask ###\n\n```python\nfrom visual_compare.doc.visual import Visual\n\ndef get_path(filename):\n image_base = '../../files/images/'\n return image_base + filename\n\nreference_image = get_path('123.png')\ntest_image = get_path('124.png')\nmask_images = [get_path('000.png')]\nvt = Visual()\nmask = vt.generate_mask(reference_image, mask_images)\nis_diff, res = vt.compare_images(reference_image, test_image, mask=mask)\nprint(res)\nassert is_diff is True\n```\n\n Result as follows\n\n![2.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/2.jpg)\n\n### Compare images with OCR ###\n\n```python\nfrom visual_compare.doc.visual import Visual\n\ndef get_path(filename):\n image_base = '../../files/images/'\n return image_base + filename\n\nreference_image = get_path('123.png')\ntest_image = get_path('124.png')\nvt = Visual()\nis_diff, res = vt.compare_images(reference_image, test_image, force_ocr=True, lang=['ch_sim', 'en'])\nprint(res)\nassert is_diff is True\n```\n\n Result as follows\n\n![3.jpg](https://github.com/cuidingyong/visual-compare/raw/main/files/result/3.jpg)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Image and PDF Compare",
"version": "1.0.2.3",
"project_urls": {
"Homepage": "https://github.com/cuidingyong/visual-compare"
},
"split_keywords": [
"visual",
"compare",
"image",
"pdf",
"diff"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6dde28e7ba550212a54213f658dffa1062d5f6b5acd4345afd8e5a9dd8b0915d",
"md5": "6b1a516a9839cef2c04fbfe15897f1ef",
"sha256": "de6366dcb0cba30779eba1e57153f2d7534cae02a38a3a5fe265eb7f0f817953"
},
"downloads": -1,
"filename": "visual_compare-1.0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b1a516a9839cef2c04fbfe15897f1ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 38848,
"upload_time": "2023-05-24T06:29:45",
"upload_time_iso_8601": "2023-05-24T06:29:45.356994Z",
"url": "https://files.pythonhosted.org/packages/6d/de/28e7ba550212a54213f658dffa1062d5f6b5acd4345afd8e5a9dd8b0915d/visual_compare-1.0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f596b5110e33d50bacb399f2923cd3ad8761b7a478e5d4d9a760f2cd47677d6",
"md5": "b3b243998bdee9d158e726b65368c7b0",
"sha256": "dc7c4ef8c8f4d3d6657498507f161f0fb24d956f8f379673e13a679c042ddafd"
},
"downloads": -1,
"filename": "visual-compare-1.0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "b3b243998bdee9d158e726b65368c7b0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31360,
"upload_time": "2023-05-24T06:29:48",
"upload_time_iso_8601": "2023-05-24T06:29:48.304083Z",
"url": "https://files.pythonhosted.org/packages/8f/59/6b5110e33d50bacb399f2923cd3ad8761b7a478e5d4d9a760f2cd47677d6/visual-compare-1.0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-24 06:29:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cuidingyong",
"github_project": "visual-compare",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "visual-compare"
}