Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: tools/site_compare/operators/equals_with_mask.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/site_compare/operators/equals.py ('k') | tools/site_compare/scrapers/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 """Compare two images for equality, subject to a mask.""" 5 """Compare two images for equality, subject to a mask."""
7 6
8 from PIL import Image 7 from PIL import Image
9 from PIL import ImageChops 8 from PIL import ImageChops
10 9
11 import os.path 10 import os.path
12 11
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if mask.size != im1.size: 48 if mask.size != im1.size:
50 return ("The mask is of a different size than the images (%r vs %r)" % 49 return ("The mask is of a different size than the images (%r vs %r)" %
51 (mask.size, im1.size), mask) 50 (mask.size, im1.size), mask)
52 51
53 diff = ImageChops.multiply(diff, mask.convert(diff.mode)) 52 diff = ImageChops.multiply(diff, mask.convert(diff.mode))
54 53
55 if max(diff.getextrema()) != (0, 0): 54 if max(diff.getextrema()) != (0, 0):
56 return ("The images differ", diff) 55 return ("The images differ", diff)
57 else: 56 else:
58 return None 57 return None
59
60
61
OLDNEW
« no previous file with comments | « tools/site_compare/operators/equals.py ('k') | tools/site_compare/scrapers/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698