You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

diffimg

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diffimg - pypi Package Compare versions

Comparing version
0.1.6
to
0.1.7
+2
-2
diffimg.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: diffimg
Version: 0.1.6
Version: 0.1.7
Summary: Get the % difference in images + generate a diff image

@@ -9,5 +9,5 @@ Home-page: https://github.com/nicolashahn/python-image-diff

License: UNKNOWN
Download-URL: https://github.com/nicolashahn/python-image-diff/archive/v0.1.6.tar.gz
Download-URL: https://github.com/nicolashahn/python-image-diff/archive/v0.1.7.tar.gz
Description: UNKNOWN
Keywords: diff,difference,image
Platform: UNKNOWN

@@ -7,5 +7,4 @@ #!/usr/bin/env python

from PIL import Image, ImageChops, ImageStat
from os import remove
diff_img_file = 'diff_img.jpg'
DIFF_IMG_FILE = 'diff_img.jpg'

@@ -15,3 +14,3 @@ def diff(im1_file,

delete_diff_file=False,
diff_img_file=diff_img_file):
diff_img_file=DIFF_IMG_FILE):
'''Calculate the difference between two images of the same size

@@ -23,13 +22,18 @@ by comparing channel values at the pixel level.

'''
# Generate diff image in memory.
im1 = Image.open(im1_file)
im2 = Image.open(im2_file)
diff_img = ImageChops.difference(im1,im2)
diff_img.convert('RGB').save(diff_img_file)
if not delete_diff_file:
diff_img.convert('RGB').save(diff_img_file)
# Calculate difference as a ratio.
stat = ImageStat.Stat(diff_img)
# can be [r,g,b] or [r,g,b,a]
# Can be [r,g,b] or [r,g,b,a].
sum_channel_values = sum(stat.mean)
max_all_channels = len(stat.mean) * 100
diff_ratio = sum_channel_values/max_all_channels
if delete_diff_file:
remove(diff_img_file)
return diff_ratio
Metadata-Version: 1.1
Name: diffimg
Version: 0.1.6
Version: 0.1.7
Summary: Get the % difference in images + generate a diff image

@@ -9,5 +9,5 @@ Home-page: https://github.com/nicolashahn/python-image-diff

License: UNKNOWN
Download-URL: https://github.com/nicolashahn/python-image-diff/archive/v0.1.6.tar.gz
Download-URL: https://github.com/nicolashahn/python-image-diff/archive/v0.1.7.tar.gz
Description: UNKNOWN
Keywords: diff,difference,image
Platform: UNKNOWN

@@ -5,6 +5,7 @@ try:

from distutils.core import setup
version = '0.1.7'
setup(
name = 'diffimg',
packages = ['diffimg'], # this must be the same as the name above
version = '0.1.6',
version = version,
description = 'Get the % difference in images + generate a diff image',

@@ -14,3 +15,3 @@ author = 'Nicolas Hahn',

url = 'https://github.com/nicolashahn/python-image-diff',
download_url = 'https://github.com/nicolashahn/python-image-diff/archive/v0.1.6.tar.gz',
download_url = 'https://github.com/nicolashahn/python-image-diff/archive/v{}.tar.gz'.format(version),
keywords = ['diff', 'difference', 'image'],

@@ -17,0 +18,0 @@ classifiers = [],