bin/diff-pdf-page.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
New commits: commit dff45ef0141d6d2cbe4634dec5ef59cd363a6725 Author: Justin Luth <[email protected]> AuthorDate: Tue Oct 22 18:54:14 2024 -0400 Commit: Justin Luth <[email protected]> CommitDate: Thu Oct 24 15:54:48 2024 +0200 diff-pdf-page.py: remove intermediate composite step One convert step can be eliminated, which should help with performance. Change-Id: I860c90fec7f178b456b942d8ad4e4ec5d0412e05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175467 Reviewed-by: Justin Luth <[email protected]> Tested-by: Jenkins Reviewed-by: László Németh <[email protected]> diff --git a/bin/diff-pdf-page.py b/bin/diff-pdf-page.py index 81bf472d95a7..fced5c84da77 100755 --- a/bin/diff-pdf-page.py +++ b/bin/diff-pdf-page.py @@ -36,9 +36,7 @@ def main(): b_png = tempfile.NamedTemporaryFile(suffix=".png") b_pdf = args.b_pdf + "[" + args.page + "]" 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]) + run([CONVERT_CMD, a_png.name, b_png.name, "-composite", "-background", "white", "-flatten", args.diff_png]) if __name__ == "__main__": main() commit 9254ed4a8b279152f84a02fccc670d7a845cdc66 Author: Justin Luth <[email protected]> AuthorDate: Tue Oct 22 18:43:11 2024 -0400 Commit: Justin Luth <[email protected]> CommitDate: Thu Oct 24 15:54:39 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]> 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])
