compression op• Data kinds: image2d → image2d
• Call: import imgforensics; imgforensics.error_level_map(image, quality: 'int' = 90, normalize: 'bool' = True) -> 'np.ndarray' (or opsimgforensics.get("error_level_map"))
ELA (error-level analysis). A map of the difference after re-compressing at a given quality. `image2d`.
> The detailed description below is the original text — the summary and the headings are translated.
Krawetz 2007。JPEG は 8x8 ブロックごとに量子化するので、一度圧縮された領域は
同じ品質で再圧縮しても誤差が小さく、後から貼られた / 描かれた領域は誤差が
大きく残る、という考え方に基づく。
`normalize=True`(既定)なら最大値で割って [0, 1] にする(見るため)。
`False` なら 8 bit 階調そのままの絶対誤差(数えるため)。
**Pillow が無ければ :class:ImportError。近似には落ちない。** DCT の量子化だけを
numpy で真似ると、符号化器の丸め・色空間変換・チャネル間引きが消えた *別物* に
なる。それを ELA と名乗ると、この族が潰そうとしている「もっともらしく間違う」を
自分でやることになる。
この地図が言えないこと(`tests/test_imgforensics.py` が数で固定。
256x256 の 1/f^1.6 画像の中央 64x64 に別画像を貼ったもの):
==================================== =============== =============== =========
元の画像 貼付部の ELA 背景の ELA 比
==================================== =============== =============== =========
無圧縮(一度も JPEG を通らない) 0.1966 0.1793 1.096
一度 JPEG 品質 75 を通した 0.1966 0.0401 4.898
==================================== =============== =============== =========
• 無圧縮 PNG では何も言えない。上の 1.096 倍は「貼った所と貼っていない所が
区別できない」という意味である。**ELA が意味を持つのは「元が JPEG」のとき
だけ**で、そのとき初めて 4.898 倍という差になる。
• よく言われる「ELA は高周波を追っているだけ」も、この画像では成り立たない ——
ELA と Sobel 勾配強度の相関は 0.003(無圧縮)/ 0.057(JPEG 済み)。
ELA は 8x8 ブロックの量子化残差を見ているので、勾配とは別のものを測っている。
それでも上の表のとおり 無圧縮では改竄を分離しない。「勾配の言い換えだから
駄目」なのではなく、比べる基準になる量子化履歴が無いから駄目である。
• 平坦な領域は圧縮しても誤差が出ないので、改竄されていても暗いままになる。
• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).
• Operator provenance and references — the sources of the research/methods this op family came from.
• The canonical algorithm (author, year) and its uses are named in the family usage guide above.
• image_forensics_audit — py -3.11 examples/image_forensics_audit.py
image2d as input)perceptual_hash · fingerprint_correlate · jpeg_quality_estimate · jpeg_ghost_map · noise_inconsistency_map · copy_move_regions · watermark_embed · watermark_extract
compression)jpeg_quality_estimate · jpeg_ghost_map · jpeg_ghost_quality
*Provenance: imgforensics.py — IMGFORENSICS operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.