From 5693fcf8ea6357d19f3f4960c81e443104424ab6 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 19 Dec 2006 12:32:42 +0100 Subject: [PATCH] output-distance: don't barf if either to be compared PNG is borked. --- buildscripts/output-distance.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buildscripts/output-distance.py b/buildscripts/output-distance.py index 8f1b68633c..787c3a71a7 100644 --- a/buildscripts/output-distance.py +++ b/buildscripts/output-distance.py @@ -285,9 +285,14 @@ def compare_png_images (old, new, dir): return tuple (map (int, m.groups ())) - dims1 = png_dims (old) - dims2 = png_dims (new) - + dest = os.path.join (dir, new.replace ('.png', '.compare.png')) + try: + dims1 = png_dims (old) + dims2 = png_dims (new) + except AttributeError: + os.link (new, dest) + return + dims = (min (dims1[0], dims2[0]), min (dims1[1], dims2[1])) @@ -298,7 +303,6 @@ def compare_png_images (old, new, dir): system ("convert diff.png -border 2 -blur 0x3 -negate -channel alpha,blue -type TrueColorMatte -fx 'intensity' matte.png") - dest = os.path.join (dir, new.replace ('.png', '.compare.png')) system ("composite matte.png %(new)s %(dest)s" % locals ()) class FileLink: -- 2.39.2