Disable Image Comparison in PDF Documents

GroupDocs.Comparison for Python via .NET can skip image comparison when diffing PDFs — useful when only text changes matter and embedded graphics would otherwise add noise to the result.

Example: Disable image comparison for PDFs

from groupdocs.comparison import Comparer
from groupdocs.comparison.options import CompareOptions, ImagesInheritance

def disable_image_comparison_in_pdf():
    with Comparer("./source.pdf") as comparer:
        comparer.add("./target.pdf")
        options = CompareOptions()
        options.compare_images_pdf = False
        options.images_inheritance_mode = ImagesInheritance.TARGET
        comparer.compare("./result.pdf", options)

if __name__ == "__main__":
    disable_image_comparison_in_pdf()

source.pdf is the source file used in this example. Click here to download it.

target.pdf is the target file used in this example. Click here to download it.

Binary file (PDF, 279 KB)

Download full output

Use case: speed up PDF comparisons and avoid noise from embedded graphics.

The result is as follows:

When to disable image comparison

Disable image comparison when:

  • You only care about text edits. Legal redlines, contract markup, and editorial review workflows usually treat embedded figures as visual context, not diff content.
  • The PDFs differ only in cosmetic backgrounds. Scanned letterheads, watermarks, and stamps inflate the change count without surfacing meaningful differences.
  • You need a faster comparison. Image diffing is the most expensive part of PDF comparison; skipping it can shave seconds off each comparison and is essential at high throughput.

Keep image comparison enabled when:

  • The PDFs are image-heavy (scanned forms, technical drawings, presentations exported to PDF) — image diffs are the meaningful content.
  • You need pixel-accurate change overlays combined with calculate_coordinates = True.

ImagesInheritance values

When image comparison is disabled, images_inheritance_mode controls which document’s images appear in the result PDF:

ValueBehaviour
ImagesInheritance.SOURCEThe result PDF inherits images from the source document.
ImagesInheritance.TARGETThe result PDF inherits images from the target document. Useful when the target is the “newer” version and you want its visual layer.
ImagesInheritance.AVERAGEA blended image is generated; appropriate only when the images differ only slightly.
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.