| OLD | NEW |
| 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.""" | 5 """Compare two images for equality.""" |
| 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 | 10 |
| 12 def Compare(file1, file2, **kwargs): | 11 def Compare(file1, file2, **kwargs): |
| (...skipping 16 matching lines...) Expand all Loading... |
| 29 if im1.size != im2.size: | 28 if im1.size != im2.size: |
| 30 return ("The images are of different size (%s vs %s)" % | 29 return ("The images are of different size (%s vs %s)" % |
| 31 (im1.size, im2.size), im1) | 30 (im1.size, im2.size), im1) |
| 32 | 31 |
| 33 diff = ImageChops.difference(im1, im2) | 32 diff = ImageChops.difference(im1, im2) |
| 34 | 33 |
| 35 if max(diff.getextrema()) != (0, 0): | 34 if max(diff.getextrema()) != (0, 0): |
| 36 return ("The images differ", diff) | 35 return ("The images differ", diff) |
| 37 else: | 36 else: |
| 38 return None | 37 return None |
| 39 | |
| 40 | |
| 41 | |
| OLD | NEW |