bin/diff-pdf-page.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e4cd6c8118c7fcf41dd2a4c6704060ce011405d0
Author:     Justin Luth <[email protected]>
AuthorDate: Tue Oct 22 18:43:11 2024 -0400
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Oct 25 09:22:08 2024 +0200

    diff-pdf-page.py: change assumed background to transparent
    
    The page background color of a document likely is white,
    so at least the overlay (the second PNG) must be transparent.
    
    [I saw (in Draw) that PRINT-TO-PDF tended to produce a PDF
    that would have a transparent background when converted to PNG,
    but that EXPORT-TO-PDF from LO would produce a white background
    that obviously would fully overlay and obscure the first image.]
    
    (Calc and Writer's export-to-pdf produced a transparent background.)
    
    In any case, it makes sense to try to force both of these
    to have a transparent background.
    
    NOTE: It was important to place -transparent before -fuzz,
    or else 95% of all colors will be considered white
    and turned into transparent.
    
    Change-Id: I26e6081fcd59e82b2aaedb86370bdbcc57b0a24e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175466
    Reviewed-by: Justin Luth <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: László Németh <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175563
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/bin/diff-pdf-page.py b/bin/diff-pdf-page.py
index 958d487535fc..81bf472d95a7 100755
--- a/bin/diff-pdf-page.py
+++ b/bin/diff-pdf-page.py
@@ -32,10 +32,10 @@ def main():
 
     a_png = tempfile.NamedTemporaryFile(suffix=".png")
     a_pdf = args.a_pdf + "[" + args.page + "]"
-    run([CONVERT_CMD, "-density", args.density, a_pdf, "-colorspace", "RGB", 
"-fuzz", "95%", "-fill", "red", "-opaque", "black", a_png.name])
+    run([CONVERT_CMD, "-density", args.density, a_pdf, "-colorspace", "RGB", 
"-transparent", "white", "-fuzz", "95%", "-fill", "red", "-opaque", "black", 
a_png.name])
     b_png = tempfile.NamedTemporaryFile(suffix=".png")
     b_pdf = args.b_pdf + "[" + args.page + "]"
-    run([CONVERT_CMD, "-density", args.density, b_pdf, "-colorspace", "RGB", 
b_png.name])
+    run([CONVERT_CMD, "-density", args.density, b_pdf, "-colorspace", "RGB", 
"-transparent", "white", b_png.name])
     composite_png = tempfile.NamedTemporaryFile(suffix=".png")
     run([CONVERT_CMD, a_png.name, b_png.name, "-composite", 
composite_png.name])
     run([CONVERT_CMD, composite_png.name, "-background", "white", "-flatten", 
args.diff_png])

Reply via email to