Local Histogram Consistency
Detects localized brightness manipulation, content erasure, and splice seams by checking whether local contrast and tonal response stay consistent across the image. Erased regions become abnormally uniform, pasted patches carry foreign contrast, and a splice produces an abrupt change in local dynamic range.
Technical description
Local Histogram Consistency is an image-forensics indicator that detects localized brightness manipulation, content erasure, and splice seams by reproducing two examination procedures used by the United States Office of Research Integrity (ORI) in research-misconduct investigations: local histogram (dynamic-range) inconsistency and the forensic gradient map. The image is converted to grayscale and tiled into overlapping blocks. For every block the indicator measures the local dynamic range and a non-linear solarized response, then compares each block to the rest of the image and to its immediate spatial neighbourhood. Three classes of anomaly are extracted: near-uniform blocks (the signature of an erased or whitened region), anomalous contrast spikes (the signature of a pasted patch with foreign contrast), and abrupt range transitions that line up into a seam (the signature of a splice boundary). A fourth class comes from the gradient map, where a block whose mid-tone response departs from its neighbours flags subtle tonal retouching. The four anomaly counts are normalized by the total block count and combined into a single 0 to 5 score, with a discount applied to images dominated by uniform background so that chart and diagram whitespace is not scored as erasure.
How it works
The image is converted to a single-channel grayscale array using the standard luminance conversion, and the indicator is skipped when either dimension is below 96 pixels because there are then too few blocks to form a stable reference. The grayscale array is tiled into overlapping square blocks of side B = 16 pixels placed on a stride of S = 8 pixels, so consecutive blocks overlap by half their width in each direction. The block grid has dimensions n_rows by n_cols, and the total number of blocks is N_blocks.
For each block the indicator computes a robust local dynamic range using the 5th and 95th percentiles of the block intensities rather than the raw minimum and maximum, which makes the measure immune to a single hot or dead pixel:
r = P95(block) − P5(block)
The reference level for the whole image is the median of these block ranges, and the spread is summarised by a coefficient of variation (CV), defined as the standard deviation of the ranges divided by the median:
median_range = median({ r_i })
CV = std({ r_i }) / (median_range + 1e-6)
Signal A, the local histogram consistency signal, derives three anomaly sets from the block ranges. A block is a fill or erasure suspect when the image as a whole has meaningful contrast and the block is near-uniform in both relative and absolute terms, that is when all three of the following hold:
median_range > 15 (the image is not globally flat)
r < 0.12 × median_range (the block has far less contrast than typical blocks)
r < 10 (the block is genuinely near-uniform on the 0 to 255 scale)
The absolute ceiling r < 10 ensures that the block is truly flat, as a digitally filled or whitened region is, and prevents merely lower-contrast natural areas from being treated as erasures. A block is a contrast-spike suspect, indicating a pasted region whose local contrast does not match the surrounding image, when its range exceeds a fixed multiple of the median:
r > 3.5 × median_range
Splice boundaries are found by comparing each block to its eight immediate neighbours in the block grid. For a block with range r, the indicator collects the ranges of its valid neighbours, computes their mean mu_n and standard deviation sigma_n, and forms a z-score (the number of neighbour standard deviations by which the block departs from its neighbourhood):
z = | r − mu_n | / sigma_n
A block with at least three valid neighbours, a non-degenerate neighbour spread (sigma_n above zero), and z > 2.5 is a boundary candidate. Isolated candidates are discarded because real splice seams form lines: a boundary candidate is promoted to a confirmed splice block only when at least two boundary candidates are consecutive in the same grid row or the same grid column, which is the crude line requirement that separates a continuous seam from scattered texture noise.
Signal B, the forensic gradient map, amplifies subtle mid-tone differences with a solarize transform, a tent-shaped mapping that folds the upper half of the intensity range back down so that grey levels just above and just below 128 map to similar low values:
solarize(p) = p if p < 128
solarize(p) = 255 − p if p >= 128
Each block is summarised by the mean of its solarized pixels, sm. As in the boundary test, each block is compared with the solarized means of its eight neighbours, giving a neighbour mean mu_s, a neighbour standard deviation sigma_s, and a z-score z = | sm − mu_s | / sigma_s. A block is a gradient-map anomaly when the neighbourhood carries real signal (sigma_s above a floor of 5.0, which suppresses flat areas where any deviation is amplified) and z > 1.5, marking a region whose mid-tone response was altered relative to its surroundings.
The four anomaly counts are the number of fill blocks n_fill, splice blocks n_splice, gradient-map anomalies n_solar, and contrast spikes n_spike. The first three are converted to ratios by dividing by the total block count, for example fill_ratio = n_fill / N_blocks, and the same is done for splice_ratio and solar_ratio. The fill term carries a high weight of 25.0, except that when more than 20 percent of all blocks are uniform fill the image almost certainly has a large natural solid background, as charts, diagrams, and line drawings do, and the weight is lowered to 5.0 so that legitimate whitespace is not scored as erasure. The final score is the weighted sum of the ratios plus a small per-spike term, clamped to the 0 to 5 range:
score = min(5.0,
fill_ratio × fill_weight
+ splice_ratio × 15.0
+ solar_ratio × 10.0
+ n_spike × 0.3)
The indicator emits up to six findings, prioritising the most severe evidence first: fill and erasure blocks (reported as critical, sorted by ascending range so the flattest blocks appear first), contrast spikes (critical), splice boundary candidates (warning), and gradient-map anomalies (warning). The returned metadata records N_blocks (total_blocks), n_fill (fill_blocks), n_splice (splice_blocks), n_solar (solar_blocks), n_spike (contrast_spike_blocks), the median_range, and the coefficient of variation (mean_range_cv), so the score can be reproduced and audited from the block statistics.
Score thresholds
| Score | Interpretation |
|---|---|
| 0.0 to 1.0 | Local dynamic range and gradient-map response are consistent across the image. No erasure, contrast spike, or splice seam was detected, or any uniform regions are explained by a large natural background. |
| 2.0 to 3.0 | Some localized anomalies are present: a small fraction of near-uniform fill blocks, isolated contrast spikes, or a short boundary segment. The region of interest should be inspected manually. |
| 4.0 to 5.0 | Strong evidence of localized manipulation: a substantial fraction of erasure or contrast-spike blocks, or a confirmed splice line, or multiple gradient-map anomalies. The flagged regions warrant a misconduct-grade examination. |
Why this matters
Image manipulation is one of the most common forms of research misconduct in the experimental life sciences, where figures such as Western blots, gels, and micrographs are the primary evidence for a claim. A systematic screen of 20,621 published papers found that 3.8 percent contained problematic figures, with at least half showing features consistent with deliberate manipulation, and the prevalence rose over the surveyed decade [3]. The specific operations this indicator targets, namely erasing or whitening unwanted features and splicing foreign content into a panel, are exactly the actions that the foundational guidance on scientific image handling identifies as inappropriate changes to original data [2]. Because such edits are usually applied to a small region and matched visually to their surroundings, they are invisible to the eye but leave statistical traces: the erased region becomes abnormally uniform, the spliced patch carries foreign local contrast, and the seam between original and inserted content produces an abrupt change in local dynamic range. The local histogram and gradient-map procedures reproduced here are the same examination steps developed by the Office of Research Integrity to make those traces visible during formal misconduct investigations [1], and the broader ethics literature documents how routine the underlying manipulations have become as digital editing tools have grown more accessible [4].
Limitations
The block geometry has a fixed scale, so manipulations much smaller than a 16-pixel block or feathered edits spread across many blocks weaken the per-block contrast signature and may go undetected. Heavy lossy compression and aggressive global denoising both flatten local dynamic range and can produce uniform blocks that mimic erasure or, conversely, mask a genuine splice. The splice-boundary line requirement of two consecutive candidates is deliberately crude and can miss short or diagonal seams while occasionally promoting a strong natural edge. The forensic gradient map is a sensitivity amplifier rather than a classifier: it highlights mid-tone regions that differ from their neighbourhood, which includes legitimate gradients such as fluorescence falloff, so its findings are reported as warnings for human review. Finally, the chart-whitespace discount keys on the global fraction of uniform blocks, so an image that is mostly solid background with a single small erasure receives a reduced fill weight and a correspondingly lower score.
Theoretical background
The indicator rests on the observation that authentic photographic and microscopy content has spatially coherent local statistics, because a single capture device and a single exposure imprint a consistent contrast and tonal structure across the frame. Local histogram analysis exploits this coherence by treating each block's dynamic range as a sample from one underlying distribution and flagging blocks that are inconsistent with the image-wide median, an approach formalised in the forensic examination procedures published by the Office of Research Integrity for questioned scientific images [1]. The dynamic range is estimated from the 5th and 95th percentiles rather than the extremes, a standard robust-statistics choice that prevents a single outlying pixel from dominating the measure. Comparisons against the eight-neighbour neighbourhood use the z-score, the deviation expressed in units of the local standard deviation, so that the same threshold adapts to busy and to smooth areas. The solarize transform underlying the gradient map is a non-linear contrast remapping that compresses bright tones and stretches the mid-tones where retouching is hardest to see, which is why the ORI toolset includes such gradient and contour visualisations to expose selectively remapped regions [1]. The motivation and the catalogue of manipulations these methods are designed to surface, from background cleaning to splicing and intensity adjustment, are set out in the cell-biology image-integrity literature [2][4] and quantified at scale in the biomedical image-duplication survey [3].
References
- Krueger J. Forensic Examination of Questioned Scientific Images. Accountability in Research. 2002;9(2):105-125. DOI: 10.1080/08989620212970 See also the Office of Research Integrity (ORI) Forensic Tools and Forensic Droplets, https://ori.hhs.gov/forensic-tools
- Rossner M, Yamada KM. What's in a picture? The temptation of image manipulation. Journal of Cell Biology. 2004;166(1):11-15. DOI: 10.1083/jcb.200406019
- Bik EM, Casadevall A, Fang FC. The Prevalence of Inappropriate Image Duplication in Biomedical Research Publications. mBio. 2016;7(3):e00809-16. DOI: 10.1128/mBio.00809-16
- Cromey DW. Avoiding Twisted Pixels: Ethical Guidelines for the Appropriate Use and Manipulation of Scientific Digital Images. Science and Engineering Ethics. 2010;16(4):639-667. DOI: 10.1007/s11948-010-9201-y