Image Forensics
Deck ImageForensics (Investigating Tampered Images). Types of forgery, then the investigative approaches: metadata analysis, error level analysis, key point matching (SIFT and SURF), PRNU sensor noise, statistical analysis, shadow analysis and deepfake detection.
Can we trust what we see?Search on YouTube
Digital images are no longer reliable evidence by default.
- Editing software is easy to get, so forgery has become widespread.
- An altered image is hard to spot with the eye.
- Multimedia forensics can detect signs of tampering: removal of objects, addition of objects, or other alterations.
The deck opens with two photos of the same event. One has been edited. Both look natural, which is the point: visual inspection is not enough.
Types of forgerySearch on YouTube
The deck names three classic forgeries and adds AI-generated images.
| Forgery | What the forger does | Slide example |
|---|---|---|
| Image inpainting | Removes damage or objects from an image in a natural manner and fills the gap | An object removed from an underwater scene (before and after) |
| Copy-move forgery | Copies a part of an image and pastes it in a different area of the same image | A patch of a forest scene copied over a vehicle |
| Image splicing | Cuts and pastes regions from one or more different images to make a new fake image | Two separate photos joined into one "rally" photo |
| AI-generated image | A model creates a photo-real image or face that never existed | Faces from thispersondoesnotexist.com; quiz at whichfaceisreal.com |
Copy-move keeps everything inside one picture, so the source and the copy share the same camera noise and compression. Splicing mixes pictures, so the pasted part often carries a different noise pattern, compression level or lighting. This difference decides which technique you pick later.
Image forensicsSearch on YouTube
Image forensics is a field within digital forensics. It examines and analyses digital images to determine their authenticity, origin and history.
The deck lists six investigative approaches:
- Metadata analysis
- Error level analysis (ELA)
- Statistical analysis
- Key point based matching
- PRNU based detection
- Shadow analysis
M E S K P S: Metadata, ELA, Statistics, Keypoints, PRNU, Shadows. Read it as "My Eyes See Kittens, Pugs, Sheep" (the clone samples in the deck are pugs and sheep).
Metadata analysisSearch on YouTube
Metadata is hidden information embedded in a digital image. It gives insight into the image's characteristics and history.
Types of metadataSearch on YouTube
| Type | Full form | Typical content |
|---|---|---|
| EXIF | Exchangeable Image File Format | Camera settings, date and time of capture, GPS coordinates, camera make and model |
| IPTC | International Press Telecommunications Council | Copyright, authorship |
| XMP | Extensible Metadata Platform | Copyright, authorship, editing history |
EXIF tells you about the image's origin and creation. IPTC and XMP can reveal modifications made over time.
Sample metadataSearch on YouTube
The deck shows exiftool output for a JPEG. Run the same command in the lab:
exiftool IMG001022.JPG # print all metadata tags
exiftool -a -G1 IMG001022.JPG # show duplicate tags and the group (EXIF, XMP, IPTC) of each
exiftool -gps:all IMG001022.JPG # print only the GPS tagsThe slide output includes: MIME type image/jpeg, JFIF version 1.1, Make Hewlett-Packard, Camera Model HP PhotoSmart 618, Orientation Horizontal (normal), X/Y resolution 72, Exposure Time 1/125, F Number 3.7, ISO 100, EXIF version 0210, Date/Time Original 2007:05:28 09:19:49, Shutter Speed Value 1/128, Aperture Value 4.0, Subject Distance 0.13 m.
What the findings can showSearch on YouTube
- Conflicting timestamps or GPS coordinates. These can indicate tampering or manipulation.
- Timestamps and GPS coordinates can be cross-verified with web resources. This feeds shadow analysis (sun position at that place and time).
- Missing or altered fields, such as modified camera settings.
ChallengesSearch on YouTube
- Malicious actors can strip the metadata. Images sent through WhatsApp have no metadata, because it is stripped to ease transmission.
- The device can record the geo-location inaccurately, or an attacker can spoof it.
- Time zone differences caused by camera settings.
Best practicesSearch on YouTube
- Always verify metadata together with other forensic techniques.
- Cross-reference metadata with other sources, such as witness statements or other image analysis tools.
Checking a claim against metadata. A user says a JPEG was taken on a weekend trip to San Francisco with their own phone. The metadata shows (End Sem 2025 style):
- Device Make Samsung, Model Galaxy S21
- Software: Lightroom Mobile 6.1 (Android)
- Date Created
2023:07:22 09:21:45, Date Modified2023:07:22 09:24:10 - GPS Latitude 34.052235 N, Longitude 118.243683 W
- GPS Timestamp
2023:07:22 16:21:40Z
Step 1. Location. 34.05 N, 118.24 W is in central Los Angeles, not San Francisco (about 37.8 N, 122.4 W). The place in the claim and the GPS do not match.
Step 2. Time zone. The GPS timestamp ends in Z, so it is UTC. California in July is UTC minus 7 hours. 16:21:40 UTC is 09:21:40 local, which matches Date Created. The time itself is consistent.
Step 3. Software. Lightroom Mobile is an editor. The file was processed after capture, so the pixels may not be the camera's originals.
Step 4. Modified date. Date Modified is 2 min 25 s after Date Created. This fits an edit and re-save, consistent with Step 3.
Step 5. Device. Check that the resolution (4032 x 3024), lens info and focal length are plausible for a Galaxy S21. Then confirm with ELA and PRNU, because all of these fields can be edited.
Verdict: the photo was edited, and it was not captured where the user claims.
Error level analysis (ELA)Search on YouTube
Working principleSearch on YouTube
When an image is saved and compressed several times, the altered or manipulated areas show different levels of compression artifacts from the pixels around them.
How it worksSearch on YouTube
Re-save the image at a known JPEG quality level. Subtract the re-saved image from the original. The result highlights differences in compression level, so manipulated areas stand out.
Identifying tamperingSearch on YouTube
Manipulated areas, such as cloned regions or added objects, often show higher error levels than the authentic parts. These discrepancies point to possible tampering.
Steps in ELASearch on YouTube
- Load the original image.
- Apply different levels of compression.
- Calculate the error between the compressed images.
- Normalize the error image.
- Visualize.
from PIL import Image, ImageChops, ImageEnhance
orig = Image.open("suspect.jpg").convert("RGB")
orig.save("resaved.jpg", quality=90) # step 2: re-save at a known quality
resaved = Image.open("resaved.jpg")
ela = ImageChops.difference(orig, resaved) # step 3: per-pixel error
max_diff = max(hi for lo, hi in ela.getextrema()) or 1
ela = ImageEnhance.Brightness(ela).enhance(255.0 / max_diff) # step 4: normalize
ela.save("ela.png") # step 5: view itWhy a pasted region glows in ELA (illustrative numbers). An authentic region has already been saved at quality 90 several times. A pasted region came from an uncompressed source.
Step 1. Re-save at quality 90. The authentic pixels are already near the quantization grid of quality 90, so they change little: error about 1 to 2 grey levels.
Step 2. The pasted pixels meet quality-90 quantization for the first time, so they change more: error about 8 to 10 grey levels.
Step 3. Normalize: if the largest error is 10, multiply every error by . The authentic region becomes about 25 to 50 (dark). The pasted region becomes about 200 to 255 (bright).
Reading the deck's ELA samplesSearch on YouTube
| Sample | What to observe |
|---|---|
| Child with a shark | Three different images were combined, so three different compression levels appear |
| Sea and rocks at sunset | Error spots and patches near the boat |
| Restaurant bill | Three compression levels, but caused by the rough surface, not tampering |
| Campus road | Roads and rough surfaces usually have higher error levels; the picture needs further fine tuning |
| Campus road (second view) | Observe the gradients at the top left |
| Face | ELA is not well suited to facial images |
High error is not proof of tampering. Textured areas (roads, rough paper, rocks) and sharp edges also show high error. Compare like with like: a smooth area should look like other smooth areas.
Key point based matchingSearch on YouTube
The algorithm finds keypoints: distinctive features such as corners, edges or blobs. Keypoints stay fairly stable under scaling, rotation and illumination changes. Popular detectors:
- SIFT (Scale-Invariant Feature Transform)
- SURF (Speeded Up Robust Features)
How it detects copied regionsSearch on YouTube
- Find distinctive keypoints that are stable under rotation, scaling and lighting changes.
- Build a descriptor for each keypoint's surrounding area, like a fingerprint.
- Compare the descriptors across the same image.
- Matches between keypoints in odd locations suggest copied regions.
- Analyse these matches to identify tampering.
This makes keypoint matching the main tool for copy-move forgery detection. The deck's clone samples (sheep, pugs, campus road) show matched lines joining the original and the copy.
SIFT versus SURFSearch on YouTube
| SIFT | SURF | |
|---|---|---|
| Finds keypoints and matches them across the image | Yes | Yes |
| Speed | Slower | Generally faster; suits real-time use |
| Calculations | More complex | Simpler, which can slightly reduce matching accuracy in complex scenes |
| Choice | Depends on the application and the balance you want between speed and accuracy |
PRNU based detectionSearch on YouTube
Multimedia forensics can identify the source of an image or video. PRNU is the most common metric for source identification.
PRNU (Photo Response Non-Uniformity) is the inherent sensor noise pattern present in every image a digital camera captures. It comes from slight variations in the sensitivity of individual pixels on the sensor. These variations are microscopic and unique to each camera, so they act as a digital fingerprint.
PRNU stepsSearch on YouTube
- Preprocessing. Convert the image to grayscale. PRNU analysis is usually done on grayscale images.
- Generate a noise reference image. Take a set of images from the same camera under uniform illumination. Average them to create a noise reference image.
- Extract the noise pattern. Subtract the noise reference image from the original image to get the sensor noise.
- Filtering. Apply a spatial filter or denoising technique. This enhances the PRNU and suppresses other noise.
- Normalization. Adjust intensity levels so patterns are consistent across images.
- PRNU estimation. Calculate the PRNU from the statistics of the noise pattern (mean, variance) across regions.
- Verification. Compare the estimate with known PRNU patterns, or use it for authentication and tamper detection.
P G E F N E V: "Please Give Every Fingerprint a Name, Even Virtually": Preprocess, Generate reference, Extract, Filter, Normalize, Estimate, Verify.
The PRNU slide diagram: images from a camera give noise residuals . These combine into the camera fingerprint . A test image gives its own residual . The correlation between and decides match (tick) or no match (cross).
The deck's sample patterns: a Canon PRNU estimated from 100 samples and a Nikon PRNU from 39 samples. The two look clearly different.
AdvantagesSearch on YouTube
- Shows whether an image comes from a trustworthy source (the claimed camera).
- Shows whether the image is computer generated or not.
- Splicing detection: a pasted region lacks the camera's PRNU, so its local correlation drops.
LimitationsSearch on YouTube
- An accurate PRNU needs a set of authentic images from the same camera under different (controlled) lighting.
- Accuracy depends on the quality and quantity of available images.
- PRNU should be combined with other statistical techniques, such as histograms, for accuracy and robustness.
Statistical analysisSearch on YouTube
Natural images follow statistical patterns in pixel values, noise and correlations. Tampering disturbs these patterns and leaves detectable inconsistencies.
Key approaches:
- Histogram analysis: RGB intensity distributions.
- First- and second-order statistics: mean, variance, correlation.
- Noise pattern analysis: sensor noise mismatch.
- Block-based statistics: JPEG DCT inconsistencies.
- Colour channel correlation.
- Frequency domain statistics: Fourier and wavelet features.
The deck shows red, green and blue histograms for two images (the shark composite and the sunset). Gaps, spikes or comb patterns in a histogram suggest editing such as contrast stretching or splicing.
Shadow analysisSearch on YouTube
Shadows must agree with the light source.
- Outdoors: the sun's azimuth and elevation at a given place and time are known. Use SunEarthTools (
https://www.sunearthtools.com/dp/tools/pos_sun.php) to find the sun position for the GPS location and timestamp in the metadata. Check that shadow directions and lengths match. The deck asks you to verify that a sunset photo was taken at the location its metadata claims. - Indoors or in a scene: draw lines from points on each shadow through the matching points on the objects. For one light source, all lines meet at the light. A spliced object gives a line that misses this point (the cone and table-top examples).
Shadow analysis links back to metadata. GPS plus timestamp gives the expected sun position. A mismatch between the expected and the visible shadow is strong evidence.
DeepfakesSearch on YouTube
CreationSearch on YouTube
The deck's diagram shows the standard face-swap setup:
- Training: one shared encoder learns common face features. Decoder A learns to rebuild face A. Decoder B learns to rebuild face B.
- Generation: encode a frame of face A, then decode it with decoder B. The output shows person B with A's expression and pose.
DetectionSearch on YouTube
- Facial recognition and analysis
- Behavioural and movement analysis
- Audio analysis
- Consistency and context checks
- Detection by eye blinking (early deepfakes blinked unnaturally or not at all)
As creators refine deepfakes, detection tools must keep evolving.
Choosing the techniqueSearch on YouTube
| Forgery or question | Best first technique | Why |
|---|---|---|
| Copy-move | Key point matching (SIFT/SURF) | Source and copy are in the same image, so descriptors match each other |
| Splicing | ELA, PRNU, shadow/lighting | Pasted region has a different compression level, no matching sensor noise, wrong light |
| Inpainting (object removal) | ELA, statistical and noise analysis | Filled area has smooth, synthetic texture with different noise and compression |
| Which camera took it? | PRNU | Sensor fingerprint is unique to the camera |
| When and where? | Metadata, then shadow analysis | EXIF time and GPS, checked against the sun position |
| AI or deepfake | PRNU (computer generated or not), deepfake checks | No real sensor noise; unnatural blinking or motion |
EXP 15: image forensics. The task gave 11 images in a shared folder. For every image, document the investigation steps, the analysis and the final inference. Any technique was allowed, but the ones taught in class were mandatory.
The submitted report ran the same pipeline on each image: file format, size and resolution, then exiftool metadata (saved as results/imgN/metadata.txt), an ELA image, RGB histograms, and a copy-move check with SIFT. Examples of findings:
img2.jpg: Photoshop editing history and colour profile in the metadata, so it was processed after capture.img3.jpg: Nikon EXIF plus Photoshop metadata with multiple saves, so a real capture that was later edited.IMG5.JPG,IMG6.jpg: Nikon D5600 with full EXIF (lens, exposure, shutter), consistent with direct capture.img7.jpeg: iPhone 13 with GPS and orientation, a typical smartphone capture.
Quick self-testSearch on YouTube
Define image forensics and list its investigative approaches.
Image forensics examines digital images to determine their authenticity, origin and history. Approaches: metadata analysis, error level analysis, statistical analysis, key point based matching, PRNU based detection and shadow analysis (plus deepfake detection checks).
Distinguish copy-move forgery, splicing and inpainting.
Copy-move copies a region and pastes it elsewhere in the same image. Splicing combines regions from one or more different images into a new fake. Inpainting removes damage or objects and fills the area naturally.
Name the three common metadata standards and what each holds.
EXIF: camera settings, date and time, GPS. IPTC: copyright and authorship. XMP: copyright, authorship and editing history.
Give two challenges of metadata analysis and one best practice.
Metadata can be stripped (WhatsApp strips it); GPS can be inaccurate or spoofed; time zone settings can shift times. Best practice: verify metadata with other forensic techniques and cross-reference other sources.
State the working principle of ELA and its steps.
Altered regions show different compression artifact levels from their surroundings. Steps: load the original, apply different compression levels, calculate the error between them, normalize the error image, visualize. Manipulated areas show higher error.
Why can ELA give a false alarm?
Rough textures (roads, rough paper) and edges naturally have higher error levels. ELA is also not well suited to facial images. High error must be compared with similar regions and confirmed with other methods.
How does keypoint matching detect copy-move forgery? Compare SIFT and SURF.
It finds stable keypoints (corners, edges, blobs), builds a descriptor for each, and compares descriptors across the image. Matches in odd locations reveal copied regions. SURF is faster with simpler calculations; SIFT is slower but can be more accurate in complex scenes.
What is PRNU and why does it identify a camera?
Photo Response Non-Uniformity is the sensor noise pattern caused by tiny differences in pixel sensitivity. The variations are microscopic and unique to each sensor, so they work as a fingerprint. Correlating an image's noise residual with a camera's PRNU shows whether that camera took it.
List the advantages and limitations of PRNU.
Advantages: verifies a trustworthy source, detects computer-generated images, detects splicing. Limitations: needs many authentic images from the same camera under controlled lighting, depends on image quality and quantity, and should be combined with statistics such as histograms.
How is shadow analysis used with metadata?
Take the GPS location and timestamp from EXIF. Use a sun position tool (SunEarthTools) to get the expected sun direction and height. Check that the shadows in the image match. In a scene, lines through shadow points and object points must meet at one light source.
- Forgery types: inpainting (remove), copy-move (same image), splicing (different images), plus AI-generated faces and deepfakes.
- Metadata: EXIF (camera, time, GPS), IPTC and XMP (copyright, authorship, history). Can be stripped or spoofed, so always cross-check.
- ELA: re-save at known quality, subtract, normalize. Tampered areas show higher error; textures and faces cause false alarms.
- SIFT/SURF keypoints with descriptors find copy-move regions. SURF is faster, SIFT more accurate.
- PRNU: sensor noise fingerprint for source identification, computer-generated detection and splicing. Needs many reference images.
- Statistical analysis: histograms, mean/variance/correlation, noise, JPEG DCT blocks, colour channels, Fourier/wavelet features.
- Shadow analysis checks light direction against the sun position from GPS and time.