JPEG Compression Artifacts and Error Level Analysis
Error Level Analysis detects image tampering by exploiting differences in JPEG compression residuals across regions that were saved at different quality levels or re-compressed a different number of times. This topic explains the quantisation mechanism that underlies ELA, how to read an ELA map correctly, and the misinterpretations that make ELA unreliable in untrained hands.
Last updated:
Error Level Analysis (ELA) is a method for detecting inconsistencies in JPEG image compression history. It works by re-compressing the suspect image at a fixed, known quality level and then computing the absolute pixel-level difference between the re-compressed copy and the original. Because JPEG quantisation drives image data toward a stable low-residual floor with each successive save, regions that have been through fewer compression cycles, or that were originally saved at a higher quality than the surrounding image, retain more residual energy and appear brighter in the resulting error map. A tampered region that was pasted from a source image with a different compression history will often display a distinctly different residual magnitude from the authentic background.
The mechanism depends on the mathematics of JPEG quantisation. The JPEG standard compresses images by dividing each 8x8 pixel block into frequency components using the Discrete Cosine Transform, then dividing each component by a quality-dependent step size and rounding to an integer. This rounding introduces error. On a second save, the already-rounded values are close to the new quantisation levels, so the additional error is small. The residual therefore shrinks with each re-save, converging toward a characteristic floor. ELA exploits this convergence: a uniform image will have uniform residuals, and a region that breaks that uniformity has a different compression history.
ELA was described in its current form by Neal Krawetz in 2007 and is implemented in tools such as FotoForensics. It has been used in journalistic verification, intelligence analysis, and courtroom settings across multiple countries. Its value comes with a significant caveat: bright residuals in an ELA map do not prove tampering. High-frequency content such as sharp edges, fine text, and complex textures always shows high residuals regardless of editing. ELA is most useful as a hypothesis-generating tool that directs further analysis, and its findings are most credible when corroborated by metadata examination, copy-move detection, or noise inconsistency analysis.
By the end of this topic you will be able to:
- Explain how JPEG quantisation works and why successive saves reduce compression residuals toward a stable floor.
- Describe the ELA procedure, including the choice of reference quality setting and why that choice affects the resulting error map.
- Interpret an ELA map correctly, distinguishing high-frequency content artifacts from genuine compression-history inconsistencies.
- Identify the three most common misreadings of ELA output and explain why each can lead to a false conclusion.
- Describe the evidentiary limitations of ELA and explain how it should be combined with other forensic methods when presenting findings in legal proceedings.
- Discrete Cosine Transform (DCT)
- The mathematical transform JPEG uses to convert each 8x8 pixel block from the spatial domain into frequency coefficients. Higher-frequency coefficients represent fine detail and edges; lower-frequency coefficients represent broad tonal areas. Quantisation is applied to these coefficients, not to raw pixel values.
- Quantisation step size
- A quality-dependent divisor applied to each DCT coefficient before rounding. A larger step size (lower quality) discards more information and introduces more rounding error on the first save. The JPEG quality setting controls the step sizes through a quantisation table.
- Error Level Analysis (ELA)
- A forensic method that re-compresses a JPEG at a known quality and measures the absolute pixel difference between the re-compressed and original versions. The resulting map highlights regions with a different compression history from the surrounding image.
- ELA residual
- The pixel-level absolute difference at a given location after re-compression. High residual means the pixel value moved substantially on re-compression, indicating the region had more information available to lose. Low residual means the region was already near the quantisation floor.
- Compression floor
- The stable low-residual state that a JPEG region approaches after many successive saves at the same quality. Once the DCT coefficients are near their quantisation levels, re-saving changes them very little, and ELA shows near-zero residual.
- Reference quality
- The quality setting used to re-compress the image when computing ELA. The choice of reference quality controls the magnitude of all residuals in the map. Using inconsistent reference qualities when comparing images makes the maps incomparable.
How JPEG quantisation works
JPEG compression proceeds in several stages. First, the image is converted from RGB to a luminance-chrominance colour model. Then each channel is divided into 8x8 pixel blocks. Each block is transformed by the Discrete Cosine Transform into 64 frequency coefficients: the DC coefficient at position (0,0) captures the average brightness of the block, and the 63 AC coefficients at increasing frequencies capture progressively finer detail. The human visual system is more sensitive to luminance changes at low frequencies and less sensitive at high frequencies, so JPEG exploits this by applying larger quantisation divisors to high-frequency coefficients.
Quantisation divides each DCT coefficient by a step size from a quantisation table and rounds the result to an integer. The JPEG quality setting, typically a number from 1 to 100, is a shorthand for scaling the entire quantisation table: quality 95 uses small step sizes, preserving most information; quality 50 uses large step sizes, discarding much of it. The rounding step is where information is lost permanently. When the file is later decoded, each quantised coefficient is multiplied back by the step size, but the original pre-rounding value is not recoverable.
On a second save, the decoded pixel values, already affected by rounding from the first save, go through the same process again. But now the DCT coefficients are already close to multiples of the step size, because they were generated by multiplying quantised integers. Re-quantising them introduces only a small additional error. This is the convergence effect: each save reduces the remaining information in the file, and after enough saves the image reaches a state where re-saving changes almost nothing. The residual falls to near zero.
| Compression history | Typical ELA residual | Interpretation |
|---|---|---|
| First save at high quality (95) | High | Much information still present; large rounding error on re-compression |
| Two saves at same quality | Medium | Partial convergence; some information lost on first save |
| Many saves at same quality | Near zero | Near quantisation floor; re-compression changes almost nothing |
| Pasted region from higher-quality source | High relative to surroundings | Region has different compression history; compression-history inconsistency |
| Pasted region from lower-quality source | Low relative to surroundings | Region is already more compressed than surroundings; also an inconsistency |
The ELA procedure
Performing ELA requires four steps. First, obtain the original image file, ideally as a bit-for-bit copy with provenance documentation. Do not accept a screenshot or a re-saved copy as the starting point, because doing so introduces an additional compression cycle and erases the history difference you are trying to detect. Second, re-compress the image at a chosen reference quality, typically between 70 and 95, using the same JPEG codec baseline DCT mode. Third, compute the absolute pixel difference between the re-compressed image and the original, channel by channel. Fourth, scale or amplify the result for visual display, because raw differences may be too small to see without magnification.
The choice of reference quality matters. If you choose a reference quality lower than the original save quality, all residuals will be large, obscuring the relative differences you want to see. If you choose a reference quality close to the original save quality, genuine history inconsistencies are most visible. In practice, many analysts use quality 95 as a default reference for an image they believe was originally saved near that level, and experiment with adjacent values to confirm that a suspect region consistently stands out across the range. The FotoForensics web tool and the open-source jpegsnoop utility can both report the quantisation tables embedded in the original file, which gives an estimate of the original quality setting.
Display amplification is the final step. Differences of a few pixel values become visible only when multiplied by a scaling factor, typically 10 to 20 times. This scaling is purely for visualisation; it does not change the underlying measurement. Analysts should report the reference quality and scaling factor used so that another analyst can reproduce the map exactly.
Reading an ELA map correctly
The first rule of ELA interpretation is that bright areas do not mean tampering. High-frequency content, including sharp edges, text, fine fabric patterns, and foliage, always produces high residuals regardless of whether the image has been edited. This is because the DCT coefficients for those regions are spread across many frequency channels, and quantisation rounding affects more of them. An ELA map of a completely authentic portrait photograph will show bright residuals around hair, eyelashes, and clothing texture. That brightness is normal.
What is meaningful is relative brightness within the same image, holding image content constant. If a smooth sky background shows uniformly low residuals across the entire image, but a small patch of that sky shows residuals as high as the sharp edges, that patch is anomalous. It has a compression history different from the surrounding smooth region. That anomaly warrants further investigation. Conversely, if a region within a complex texture shows residuals substantially lower than the surrounding texture, that is also anomalous: the region may have been sourced from a more-compressed original.
A related trap is comparing two images without controlling for the reference quality. An ELA map produced at quality 95 and an ELA map produced at quality 80 are on entirely different scales. Investigators who look at two such maps side by side and compare absolute brightness levels will reach unreliable conclusions. Within a single analysis, use one reference quality and report it.
Common misreadings and their causes
Three systematic errors recur in published ELA misreadings, and they share a common cause: applying ELA without understanding that it measures compression history, not content authenticity.
The first misreading is false positives from inherent high-frequency content. An analyst unfamiliar with how JPEG encodes fine detail sees bright residuals around text embedded in an image and concludes it was overlaid after the original photograph was taken. In many cases, text rendered into an image at save time produces exactly the same ELA signature as text composited later, because both are high-frequency features that resist quantisation convergence. Without corroborating evidence, such as metadata inconsistency or shadow direction mismatch, bright residuals at a text overlay are not diagnostic.
The second misreading is false negatives from a low-quality original. If the original image was saved at quality 50, all regions are already near the quantisation floor. A spliced region sourced from quality 50 content will show the same near-zero residuals as the authentic background, and ELA will not differentiate them. ELA is most sensitive when the original quality is high and the tampered region comes from a substantially different quality source. It is least sensitive when all source materials have similar compression histories.
The third misreading is comparison failure across resaved copies. Social media platforms, messaging applications, and content management systems routinely recompress images on upload. A forensic analyst who obtains a JPEG from a social media download is typically working with a platform-recompressed copy, not the original. ELA on that copy reveals the platform's compression history, not the author's. Presenting that ELA map as evidence of tampering in the original is methodologically wrong. The chain of custody for the digital file is as important as the chain of custody for a physical exhibit.
ELA in context: combining methods
No single image forensic method is reliable in isolation. ELA detects compression-history inconsistencies. Copy-move and splicing detection finds duplicated or cloned regions within the same image. Noise inconsistency and lighting analysis identifies regions where the sensor noise pattern or illumination geometry is inconsistent with the rest of the frame. Metadata analysis checks whether EXIF timestamps, GPS data, and camera model strings are internally consistent. Each method has blind spots that another method covers.
A finding of compression-history inconsistency from ELA is strengthened when the same region also shows: an implausible noise level relative to adjacent regions; shadow geometry that does not match the light sources visible elsewhere in the frame; a copy-move detection match with another part of the image; or an EXIF modification timestamp more recent than the capture timestamp. When multiple independent methods agree on the same region, the convergent evidence is far more credible than any single method alone.
The inverse is also true. If ELA shows an anomaly but every other method shows no inconsistency, the ELA finding requires a more conservative interpretation. Possible explanations include JPEG resave at a different quality for legitimate purposes, intentional selective editing with quality-matched tools, or simply inherent content characteristics. A forensic report that presents ELA findings without acknowledging the null findings of other methods is incomplete and may be challenged successfully in court.
ELA in legal proceedings
When ELA evidence is presented in court, the admissibility question turns on whether the method meets the jurisdiction's standard for reliable expert methodology. In the United States, Federal Rules of Evidence Rule 702 (as interpreted through Daubert v. Merrell Dow Pharmaceuticals, 509 U.S. 579, 1993) requires that the method rest on sufficient facts, be the product of reliable principles and methods, and be applied reliably to the facts of the case. ELA's theoretical basis in JPEG quantisation is sound, but its limitations in high-frequency regions and its dependence on an unmodified original mean that an expert witness must address those limitations explicitly.
In the United Kingdom, expert evidence in criminal proceedings is governed by Criminal Procedure Rules Part 19 and the associated Criminal Practice Direction. The expert must state the substance of all material facts, including any that undercut the opinion, and must acknowledge where the opinion is uncertain. Under this framework, an expert who presents ELA as conclusive proof of tampering without discussing the method's inherent limitations faces a strong cross-examination challenge.
In India, digital evidence is governed by the Bharatiya Sakshya Adhiniyam 2023, which replaced the Indian Evidence Act 1872. The Act requires that electronic records be produced with a certificate attesting to the integrity and proper functioning of the computer system and the accuracy of the output. An ELA analysis output meets this requirement only if the analyst can certify the integrity of the input file, the software used, and the process. Courts in the European Union apply similar principles under national evidence rules informed by the EU's e-IDAS Regulation framework for electronic evidence. Across all these jurisdictions, the practical requirement is the same: document the acquisition, the method, the reference parameters, and the limitations.
Why does a JPEG region show lower ELA residuals after multiple saves at the same quality setting?
Key Takeaways
- JPEG quantisation rounds DCT coefficients, introducing rounding error on first save; each subsequent save reduces the additional error as coefficients converge toward quantisation levels, creating the stable low-residual floor that ELA exploits.
- ELA detects compression-history inconsistencies, not content inauthenticity. Bright residuals in high-frequency regions such as edges, text, and fine texture are expected and do not indicate tampering.
- The choice of reference quality controls the magnitude of all residuals; analysts must report the reference quality and display scaling factor so that results are reproducible and comparable across reports.
- ELA is invalid when applied to a platform-recompressed copy rather than the original file; the chain of digital custody for the file is as important as the physical chain of custody for a traditional exhibit.
- ELA findings are most credible when corroborated by independent methods such as noise inconsistency analysis, copy-move detection, or metadata examination; a single ELA map is insufficient to support a finding of tampering in court under the evidentiary standards of the US, UK, India, or the EU.
What is Error Level Analysis and what does it detect?
Why does JPEG quantisation produce detectable artifacts?
What are the most common misreadings of an ELA map?
Can ELA detect AI-generated images or deepfakes?
What is the legal status of ELA evidence in court?
Test yourself on Multimedia Authentication and Deepfake Forensics with free, timed mocks.
Practice Multimedia Authentication and Deepfake Forensics questionsSpotted an error in this page? Report a correction or read our editorial standards.