Bug#851359: diffoscope: Improve support for comparing images

2017-04-17 Thread Maria Glukhova
Hi,

I believe the attached patch provides the requested feature.
I would be very grateful for any review or general advice on how to make
it better.
From 7bdcf310284a11e788fe761f86b1d1dbb51cf968 Mon Sep 17 00:00:00 2001
From: Maria Glukhova 
Date: Sat, 1 Apr 2017 22:07:54 +0300
Subject: [PATCH] Add visual difference between images in HTML output. (Closes:
 #851359)

When comparing JPEG, ICO, PNG or static GIF images with HTML output,
construct visual diffrence images using ImageMagick.
Two types of visual difference images are constructed, one with all
the different pixels outlined (pixel difference) and one being the
animation formed from the compared images (flicker difference).
The constructed images are converted to base64 and stored in
VisualDifference object together with their type. They are then
printed in the HTML output using data URI.
If none of the HTML output options is specified, visual difference
is not computed.
---
 diffoscope/comparators/gif.py|  33 +++-
 diffoscope/comparators/image.py  |  74 +--
 diffoscope/comparators/png.py|  24 +++-
 diffoscope/config.py |   1 +
 diffoscope/difference.py |  29 ++
 diffoscope/external_tools.py |   4 ++
 diffoscope/main.py   |   2 +
 diffoscope/presenters/html/html.py   |  21 ++
 tests/comparators/test_gif.py|  19 +
 tests/comparators/test_ico_image.py  |  10 +
 tests/comparators/test_jpeg_image.py |   9 +
 tests/comparators/test_png.py|  10 +
 tests/data/test3.gif | Bin 0 -> 854 bytes
 tests/data/test4.gif | Bin 0 -> 2094 bytes
 tests/test_presenters.py |  27 +
 15 files changed, 257 insertions(+), 6 deletions(-)
 create mode 100644 tests/data/test3.gif
 create mode 100644 tests/data/test4.gif

diff --git a/diffoscope/comparators/gif.py b/diffoscope/comparators/gif.py
index d01d7aa..fb60416 100644
--- a/diffoscope/comparators/gif.py
+++ b/diffoscope/comparators/gif.py
@@ -18,12 +18,18 @@
 # along with diffoscope.  If not, see .
 
 import re
+import subprocess
+import logging
 
 from diffoscope.tools import tool_required
 from diffoscope.difference import Difference
+from diffoscope.config import Config
 
 from .utils.file import File
 from .utils.command import Command
+from .image import pixel_difference, flicker_difference, get_image_size
+
+logger = logging.getLogger(__name__)
 
 
 class Gifbuild(Command):
@@ -41,14 +47,37 @@ class Gifbuild(Command):
 return b""
 return line
 
+@tool_required('identify')
+def is_image_static(image_path):
+return subprocess.check_output(('identify', '-format',
+'%n', image_path)) == b'1'
 
 class GifFile(File):
 RE_FILE_TYPE = re.compile(r'^GIF image data\b')
 
 def compare_details(self, other, source=None):
-return [Difference.from_command(
+gifbuild_diff = Difference.from_command(
 Gifbuild,
 self.path,
 other.path,
 source='gifbuild',
-   )]
+)
+differences = [gifbuild_diff]
+if (gifbuild_diff is not None) and Config().html_output and \
+(get_image_size(self.path) == get_image_size(other.path)):
+try:
+own_size = get_image_size(self.path)
+other_size = get_image_size(other.path)
+self_static = is_image_static(self.path)
+other_static = is_image_static(other.path)
+if (own_size == other_size) and self_static and other_static:
+logger.debug('Generating visual difference for %s and %s',
+ self.path, other.path)
+content_diff = Difference(None, self.path, other.path,
+  source='Image content')
+content_diff.add_visuals([pixel_difference(self.path, other.path),
+ flicker_difference(self.path, other.path)])
+differences.append(content_diff)
+except subprocess.CalledProcessError:  #noqa
+pass
+return differences
diff --git a/diffoscope/comparators/image.py b/diffoscope/comparators/image.py
index 2e78c98..6ba7353 100644
--- a/diffoscope/comparators/image.py
+++ b/diffoscope/comparators/image.py
@@ -19,16 +19,21 @@
 
 import re
 import subprocess
+import base64
+import logging
 
 from diffoscope.tools import tool_required
 from diffoscope.tempfiles import get_named_temporary_file
-from diffoscope.difference import Difference
+from diffoscope.difference import Difference, VisualDifference
+from diffoscope.config import Config
 
 from .utils.file import File
 from .utils.command import Command
 
 re_ansi_escapes = re.compile(r'\x1b[^m]*m')
 

Fwd: teams input for stretch release coverage

2017-04-17 Thread Chris Lamb
- Original message -
From: Cédric Boutillier 
To: debian-proj...@lists.debian.org
Subject: teams input for stretch release coverage

> […]
> 
> If your team has:
> - packaged important applications,
> - gathered impressive statistics,
> - achieved some amazing goal,
> - performed very well in terms of translation, bugs handling, design,...
> - got anything you want to share with us,

I think we've hit some of these, despite stretch itself not being
reproducible :)


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-


signature.asc
Description: PGP signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

package uploaded to our repo

2017-04-17 Thread Ximin Luo
gcc-6_6.3.0-14.0~reproducible1.dsc has just been uploaded to 
https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolchain

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Bug#851359: diffoscope: Improve support for comparing images

2017-04-17 Thread Maria Glukhova
Hi Chris!

> Could you push this to a branch so we can more easily play with it? :)

Pushed to siamezzze/image-visual-comparison . Thanks for your input!


Maria



signature.asc
Description: OpenPGP digital signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds