Author: grzywacz
Date: Sun Feb 27 12:10:11 2011
New Revision: 48657

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48657&view=rev
Log:
Script to compare images pixel-by-pixel for optipng validation.

Requires Python and PIL.

Added:
    trunk/utils/compare_images.py   (with props)

Added: trunk/utils/compare_images.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/compare_images.py?rev=48657&view=auto
==============================================================================
--- trunk/utils/compare_images.py (added)
+++ trunk/utils/compare_images.py Sun Feb 27 12:10:11 2011
@@ -1,0 +1,42 @@
+#!/usr/bin/env python
+#
+#  Script to compare images pixel-by-pixel to detect corruption due to
+#  problems in tools such as optipng.
+#
+#  Takes two files as arguments, each being a list of image files.
+#  Images are being compared between the two lists, one by one.
+
+#  Run-time requirements: Python, PIL (Python Imaging Library)
+#
+#  Copyright (C) 2011 by Karol 'grzywacz' Nowak ([email protected])
+#
+#  Part of the Battle for Wesnoth Project <http://www.wesnoth.org>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2 or,
+#  at your option any later version. This program is distributed in the
+#  hope that it will be useful, but WITHOUT ANY WARRANTY. See the COPYING
+#  file for more details.
+#
+from sys import argv, exit
+
+try:
+    import Image as PIL
+except ImportError, e:
+    print "Unable to import PIL (Python Imaging Library)"
+    raise e
+
+list1 = open(argv[1])
+list2 = open(argv[2])
+
+for path1, path2 in zip(list1, list2):
+    path1 = path1.strip()
+    path2 = path2.strip()
+
+    image1 = PIL.open(path1)
+    image2 = PIL.open(path2)
+
+    if image1.tostring() != image2.tostring():
+        print path1 + " and " + path2 + " differ!"
+
+# vim: set ts=4:sw=4:expandtab

Propchange: trunk/utils/compare_images.py
------------------------------------------------------------------------------
    svn:executable = *


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to