CSDF Report
CSDF Report
Submitted By
Name: Atharva Litake
Roll no: 41143 Class: BE-1
2. PROBLEM DEFINITION
3. LEARNING OBJECTIVES
4. LEARNING OUTCOMES
5. ABSTRACT
8. CONCLUSION
1. TITLE: Digital Forensics of Images
2. PROBLEM DEFINITION:
The Challenge
4. LEARNING OUTCOMES:
The tool first examines the image's metadata for inconsistencies that
might indicate tampering. It then performs Error Level Analysis,
visualizing differences in compression levels across the image to
highlight potential areas of manipulation. For JPEG images, the tool
also analyzes quantization tables to detect patterns suggestive of
computer-generated or heavily processed images. The results are
presented in an easily interpretable format, including a visual ELA
output and textual analysis findings.
1. System Architecture
Pillow (PIL Fork): Used for opening, manipulating, and saving various image
formats.
pillow-heif: An extension to Pillow that adds support for HEIF/HEIC images.
NumPy: Utilized for efficient array operations and numerical computations.
SciPy: Employed for advanced computations, particularly the Discrete Cosine
Transform (DCT) in quantization table analysis.
Matplotlib: Used for creating and saving visualizations (optional, for future
enhancements).
python
Copy
def analyze_metadata(img):
exif_data = img._getexif()
# ... (analysis logic)
3.2 Error Level Analysis (ELA)
python
Copy
def perform_ela(img, quality=95):
# ... (ELA logic)
ela_img = Image.new('RGB', img.size, (0, 0, 0))
# ... (pixel comparison and difference calculation)
python
Copy
def analyze_quantization_table(img):
qtables = img.quantization
# ... (table extraction and analysis)
dct_lum_qtable = dct(dct(lum_qtable_array.T, norm='ortho').T,
norm='ortho')
# ... (pattern analysis)
register_heif_opener()
def analyze_metadata(img):
exif_data = img._getexif()
if not exif_data:
return "No EXIF metadata found."
return "Metadata Inconsistencies: " + ", ".join(inconsistencies) if inconsistencies else "No obvious metadata
inconsistencies found."
os.remove(temp_filename)
return ela_img
def analyze_quantization_table(img):
if img.format != 'JPEG':
return "Quantization table analysis is only applicable to JPEG images."
if not analysis_results:
return "No obvious anomalies detected in quantization table."
else:
return "Quantization Table Analysis Results:\n- " + "\n- ".join(analysis_results)
def analyze_image(image_path):
try:
with Image.open(image_path) as img:
print(f"Analyzing image: {image_path}")
print(f"Image format: {img.format}")
print(f"Image size: {img.size}")
print(f"Image mode: {img.mode}")
print("\nMetadata Analysis:")
print(analyze_metadata(img))
except Exception as e:
print(f"Error: {str(e)}")
def main():
image_path = input("Enter the path to the image file: ")
analyze_image(image_path)
if __name__ == "__main__":
main()
8. CONCLUSION