MCPcopy Create free account
hub / github.com/LCBOWER33/StegoScan / calculate_image_entropy

Function calculate_image_entropy

StegoScan.py:500–505  ·  view source on GitHub ↗

Calculate the entropy of an image to detect complexity.

(image)

Source from the content-addressed store, hash-verified

498
499
500def calculate_image_entropy(image):
501 """Calculate the entropy of an image to detect complexity."""
502 grayscale_image = image.convert('L')
503 histogram = grayscale_image.histogram()
504 hist_probabilities = [float(h) / sum(histogram) for h in histogram]
505 return -sum(p * np.log2(p) for p in hist_probabilities if p > 0)
506
507
508def is_duplicate(image_bytes, hashes):

Callers 1

extract_images_from_pdfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected