Skip to main content

Image and PDF Compare

Project description

Visual Compare

Installation

pip install visual-compare

Examples

Compare images

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

Compare images with mask

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

Compare images with OCR

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

visual-compare-1.0.2.3.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

visual_compare-1.0.2.3-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file visual-compare-1.0.2.3.tar.gz.

File metadata

  • Download URL: visual-compare-1.0.2.3.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for visual-compare-1.0.2.3.tar.gz
Algorithm Hash digest
SHA256 dc7c4ef8c8f4d3d6657498507f161f0fb24d956f8f379673e13a679c042ddafd
MD5 b3b243998bdee9d158e726b65368c7b0
BLAKE2b-256 8f596b5110e33d50bacb399f2923cd3ad8761b7a478e5d4d9a760f2cd47677d6

See more details on using hashes here.

File details

Details for the file visual_compare-1.0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for visual_compare-1.0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 de6366dcb0cba30779eba1e57153f2d7534cae02a38a3a5fe265eb7f0f817953
MD5 6b1a516a9839cef2c04fbfe15897f1ef
BLAKE2b-256 6dde28e7ba550212a54213f658dffa1062d5f6b5acd4345afd8e5a9dd8b0915d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page