summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-10-22 18:43:11 -0400
committerJustin Luth <jluth@mail.com>2024-10-24 15:54:39 +0200
commit9254ed4a8b279152f84a02fccc670d7a845cdc66 (patch)
treeda3794ffae6e772bb001071bf5a3bccc19301c2d
parenta50f65d6cc42c5815574a361525ad6dfa83fd5b5 (diff)
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 <jluth@mail.com> Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rwxr-xr-xbin/diff-pdf-page.py4
1 files changed, 2 insertions, 2 deletions
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])