gnu: openjpeg: Fix CVE-2016-5157.
[jackhill/guix/guix.git] / gnu / packages / image.scm
index 84f0396..fe21d23 100644 (file)
@@ -1,10 +1,15 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2014 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2014, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
+;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
+;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages doxygen)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages graphics)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mcrypt)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -48,7 +56,7 @@
 (define-public libpng
   (package
    (name "libpng")
-   (version "1.5.21")
+   (version "1.5.26")
    (source (origin
             (method url-fetch)
 
@@ -59,7 +67,7 @@
                         "ftp://ftp.simplesystems.org/pub/libpng/png/src"
                         "/libpng15/libpng-" version ".tar.xz")))
             (sha256
-             (base32 "19yvzw6sf9gf7v25ha9bla8bw1nijh82wj8ag6brjj3hpij1q5dm"))))
+             (base32 "0kbissyd7d4ahwdpm968nnzl7q15p6hadg44i9x0vrkrzdgdi93v"))))
    (build-system gnu-build-system)
 
    ;; libpng.la says "-lz", so propagate it.
@@ -72,6 +80,22 @@ library.  It supports almost all PNG features and is extensible.")
    (license license:zlib)
    (home-page "http://www.libpng.org/pub/png/libpng.html")))
 
+(define-public libpng-1.2
+  (package
+    (inherit libpng)
+    (version "1.2.56")
+    (source
+     (origin
+       (method url-fetch)
+       ;; Note: upstream removes older tarballs.
+       (uri (list (string-append "mirror://sourceforge/libpng/libpng12/"
+                                 version "/libpng-" version ".tar.xz")
+                  (string-append
+                   "ftp://ftp.simplesystems.org/pub/libpng/png/src"
+                   "/libpng12/libpng-" version ".tar.xz")))
+       (sha256
+        (base32 "1ghd03p353x0vi4dk83n1nlldg11w7vqdk3f99rkgfb82ic59ki4"))))))
+
 (define-public libjpeg
   (package
    (name "libjpeg")
@@ -103,44 +127,86 @@ image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.")
             (sha256 (base32
                      "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"))))))
 
+(define-public jpegoptim
+  (package
+   (name "jpegoptim")
+   (version "1.4.3")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "http://www.kokkonen.net/tjko/src/jpegoptim-"
+                                version ".tar.gz"))
+            (sha256 (base32
+                     "0k53q7dc8w5ashz8v261x2b5vvz7gdvg8w962rz9gjvkjbh4lg93"))))
+   (build-system gnu-build-system)
+   (inputs `(("libjpeg" ,libjpeg)))
+   (arguments
+    ;; no tests
+    '(#:tests? #f))
+   (synopsis "Optimize JPEG images")
+   (description
+    "jpegoptim provides lossless optimization (based on optimizing
+the Huffman tables) and \"lossy\" optimization based on setting
+maximum quality factor.")
+   (license license:gpl2+)
+   (home-page "http://www.kokkonen.net/tjko/projects.html#jpegoptim")))
+
+(define-public libicns
+  (package
+    (name "libicns")
+    (version "0.8.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://sourceforge/icns/"
+                    "libicns-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1hjm8lwap7bjyyxsyi94fh5817xzqhk4kb5y0b7mb6675xw10prk"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("libpng" ,libpng)
+       ("jasper" ,jasper)))
+    (arguments
+     `(#:tests? #t)) ; No tests.
+    (home-page "http://icns.sourceforge.net/")
+    (synopsis "Library for handling Mac OS icns resource files")
+    (description
+     "Libicns is a library for the manipulation of Mac OS IconFamily resource
+type files (ICNS).  @command{icns2png} and @command{png2icns} are provided to
+convert between PNG and ICNS. @command{icns2png} will extract image files from
+ICNS files under names like \"Foo_48x48x32.png\" useful for installing for use
+with .desktop files.  Additionally, @command{icontainer2png} is provided for
+extracting icontainer icon files.")
+    (license (list license:lgpl2.1+     ; libicns
+                   license:lgpl2.0+     ; src/apidocs.*
+                   license:gpl2+))))    ; icns2png, png2icns, icontainer2png
+
 (define-public libtiff
   (package
    (name "libtiff")
-   (version "4.0.3")
+   (replacement libtiff/fixed)
+   (version "4.0.6")
    (source (origin
             (method url-fetch)
             (uri (string-append "ftp://ftp.remotesensing.org/pub/libtiff/tiff-"
                    version ".tar.gz"))
             (sha256 (base32
-                     "0wj8d1iwk9vnpax2h29xqc2hwknxg3s0ay2d5pxkg59ihbifn6pa"))
-            (patches (map search-patch '("libtiff-CVE-2012-4564.patch"
-                                         "libtiff-CVE-2013-1960.patch"
-                                         "libtiff-CVE-2013-1961.patch"
-                                         "libtiff-CVE-2013-4231.patch"
-                                         "libtiff-CVE-2013-4232.patch"
-                                         "libtiff-CVE-2013-4244.patch"
-                                         "libtiff-CVE-2013-4243.patch"
-                                         "libtiff-CVE-2014-9330.patch"
-                                         "libtiff-CVE-2014-8127-pt1.patch"
-                                         "libtiff-CVE-2014-8127-pt2.patch"
-                                         "libtiff-CVE-2014-8127-pt3.patch"
-                                         "libtiff-CVE-2014-8127-pt4.patch"
-                                         "libtiff-CVE-2014-8128-pt1.patch"
-                                         "libtiff-CVE-2014-8128-pt2.patch"
-                                         "libtiff-CVE-2014-8128-pt3.patch"
-                                         "libtiff-CVE-2014-8129.patch"
-                                         "libtiff-CVE-2014-9655.patch"
-                                         "libtiff-CVE-2014-8128-pt4.patch"
-                                         "libtiff-CVE-2014-8128-pt5.patch")))))
+                     "136nf1rj9dp5jgv1p7z4dk0xy3wki1w0vfjbk82f645m0w4samsd"))
+            (patches (search-patches
+                      "libtiff-oob-accesses-in-decode.patch"
+                      "libtiff-oob-write-in-nextdecode.patch"
+                      "libtiff-CVE-2015-8665+CVE-2015-8683.patch"))))
    (build-system gnu-build-system)
-   (inputs `(("zlib" ,zlib)
-             ("libjpeg-8" ,libjpeg-8)))
-             ;; currently does not compile with libjpeg version 9
+   (outputs '("out"
+              "doc"))                           ;1.3 MiB of HTML documentation
    (arguments
-    `(#:configure-flags
-      (list (string-append "--with-jpeg-include-dir="
-                           (assoc-ref %build-inputs "libjpeg-8")
-                           "/include"))))
+    ;; Instead of using --docdir, this package has its own --with-docdir.
+    `(#:configure-flags (list (string-append "--with-docdir="
+                                             (assoc-ref %outputs "doc")
+                                             "/share/doc/"
+                                             ,name "-" ,version))))
+   (inputs `(("zlib" ,zlib)
+             ("libjpeg" ,libjpeg)))
    (synopsis "Library for handling TIFF files")
    (description
     "Libtiff provides support for the Tag Image File Format (TIFF), a format
@@ -149,7 +215,24 @@ Included are a library, libtiff, for reading and writing TIFF and a small
 collection of tools for doing simple manipulations of TIFF images.")
    (license (license:non-copyleft "file://COPYRIGHT"
                                   "See COPYRIGHT in the distribution."))
-   (home-page "http://www.libtiff.org/")))
+   (home-page "http://www.remotesensing.org/libtiff/")))
+
+(define libtiff/fixed
+  (package
+    (inherit libtiff)
+    (source (origin
+              (inherit (package-source libtiff))
+              (patches (search-patches
+                         "libtiff-oob-accesses-in-decode.patch"
+                         "libtiff-oob-write-in-nextdecode.patch"
+                         "libtiff-CVE-2015-8665+CVE-2015-8683.patch"
+                         "libtiff-CVE-2016-3623.patch"
+                         "libtiff-CVE-2016-3945.patch"
+                         "libtiff-CVE-2016-3990.patch"
+                         "libtiff-CVE-2016-3991.patch"
+                         "libtiff-CVE-2016-5314.patch"
+                         "libtiff-CVE-2016-5321.patch"
+                         "libtiff-CVE-2016-5323.patch"))))))
 
 (define-public libwmf
   (package
@@ -164,9 +247,18 @@ collection of tools for doing simple manipulations of TIFF images.")
         (sha256
          (base32 "1y3wba4q8pl7kr51212jwrsz1x6nslsx1gsjml1x0i8549lmqd2v"))
         (patches
-         (map search-patch '("libwmf-CVE-2006-3376.patch"
-                             "libwmf-CVE-2009-1364.patch"
-                             "libwmf-CVE-2015-0848+4588+4695+4696.patch")))))
+         (search-patches "libwmf-CAN-2004-0941.patch"
+                         "libwmf-CVE-2006-3376.patch"
+                         "libwmf-CVE-2007-0455.patch"
+                         "libwmf-CVE-2007-2756.patch"
+                         "libwmf-CVE-2007-3472.patch"
+                         "libwmf-CVE-2007-3473.patch"
+                         "libwmf-CVE-2007-3477.patch"
+                         "libwmf-CVE-2009-1364.patch"
+                         "libwmf-CVE-2009-3546.patch"
+                         "libwmf-CVE-2015-0848+CVE-2015-4588.patch"
+                         "libwmf-CVE-2015-4695.patch"
+                         "libwmf-CVE-2015-4696.patch"))))
 
     (build-system gnu-build-system)
     (inputs
@@ -191,14 +283,14 @@ the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
 (define-public leptonica
   (package
     (name "leptonica")
-    (version "1.71")
+    (version "1.72")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "http://www.leptonica.com/source/leptonica-"
                            version ".tar.gz"))
        (sha256
-        (base32 "0j5qgrff6im5n9waflbi7w643q1p6mahyf2z35gb4vj9h5p76pfc"))
+        (base32 "0mhzvqs0im04y1cpcc1yma70hgdac1frf33h73m9z3356bfymmbr"))
        (modules '((guix build utils)))
        ;; zlib and openjpg should be under Libs, not Libs.private.  See:
        ;; https://code.google.com/p/tesseract-ocr/issues/detail?id=1436
@@ -223,7 +315,8 @@ the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
      `(("openjpeg" ,openjpeg)
        ("zlib" ,zlib)))
     (arguments
-     '(#:phases
+     '(#:parallel-tests? #f ; XXX: cause fpix1_reg to fail
+       #:phases
        (modify-phases %standard-phases
          ;; Prevent make from trying to regenerate config.h.in.
          (add-after
@@ -235,7 +328,15 @@ the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
           (lambda _
             (substitute* "prog/reg_wrapper.sh"
               ((" /bin/sh ")
-               (string-append " " (which "sh") " "))))))))
+               (string-append " " (which "sh") " "))
+              (("which gnuplot") (which "gnuplot")))))
+         (add-before
+          'check 'disable-failing-tests
+          ;; XXX: 2 of 9 tests from webpio_reg fails.
+          (lambda _
+            (substitute* "prog/webpio_reg.c"
+              ((".*DoWebpTest2.* 90.*") "")
+              ((".*DoWebpTest2.* 100.*") "")))))))
     (home-page "http://www.leptonica.com/")
     (synopsis "Library and tools for image processing and analysis")
     (description
@@ -259,7 +360,7 @@ arithmetic ops.")
                           version ".tar.gz"))
         (sha256
           (base32 "1ffhgmf2fqzk0h4k736pp06z7q5y4x41fg844bd6a9vgncq86bby"))
-        (patches (list (search-patch "jbig2dec-ignore-testtest.patch")))))
+        (patches (search-patches "jbig2dec-ignore-testtest.patch"))))
 
     (build-system gnu-build-system)
     (synopsis "Decoder of the JBIG2 image compression format")
@@ -279,15 +380,19 @@ work.")
 (define-public openjpeg
   (package
     (name "openjpeg")
-    (version "2.1.0")
+    (version "2.1.1")
     (source
       (origin
         (method url-fetch)
         (uri
-         (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
+         (string-append "https://github.com/uclouvain/openjpeg/archive/v"
                         version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
         (sha256
-         (base32 "00zzm303zvv4ijzancrsb1cqbph3pgz0nky92k9qx3fq9y0vnchj"))))
+         (base32
+          "1anv0rjkbxw9kx91wvlfpb3dhppibda6kb1papny46bjzi3pzhl2"))
+        (patches (search-patches "openjpeg-CVE-2016-5157.patch"
+                                 "openjpeg-CVE-2016-7163.patch"))))
     (build-system cmake-build-system)
     (arguments
       ;; Trying to run `$ make check' results in a no rule fault.
@@ -308,7 +413,7 @@ In addition to the basic codec, various other features are under
 development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats,
 an indexing tool useful for the JPIP protocol, JPWL-tools for
 error-resilience, a Java-viewer for j2k-images, ...")
-    (home-page "https://code.google.com/p/openjpeg/")
+    (home-page "https://github.com/uclouvain/openjpeg")
     (license license:bsd-2)))
 
 (define-public openjpeg-2.0
@@ -319,10 +424,13 @@ error-resilience, a Java-viewer for j2k-images, ...")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
-                       version ".tar.gz"))
+        (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
+                       name "-" version ".tar.gz"))
        (sha256
-        (base32 "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z"))))))
+        (base32 "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z"))
+       (patches (search-patches "openjpeg-use-after-free-fix.patch"
+                                "openjpeg-CVE-2015-6581.patch"
+                                "openjpeg-CVE-2016-7163.patch"))))))
 
 (define-public openjpeg-1
   (package (inherit openjpeg)
@@ -332,22 +440,22 @@ error-resilience, a Java-viewer for j2k-images, ...")
      (origin
        (method url-fetch)
        (uri
-        (string-append "mirror://sourceforge/openjpeg.mirror/" name "-"
-                       version ".tar.gz"))
+        (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
+                       name "-" version ".tar.gz"))
        (sha256
         (base32 "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm"))))))
 
 (define-public giflib
   (package
     (name "giflib")
-    (version "4.2.3")
+    (version "5.1.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/giflib/giflib-"
-                                  (first (string-split version #\.))
-                                  ".x/giflib-" version ".tar.bz2"))
+                                  version ".tar.bz2"))
               (sha256
-               (base32 "0rmp7ipzk42r841bggd7bfqk4p8qsssbp4wcck4qnz7p4rkxbj0a"))))
+               (base32
+                "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))))
     (build-system gnu-build-system)
     (outputs '("bin"                    ; utility programs
                "out"))                  ; library
@@ -356,26 +464,25 @@ error-resilience, a Java-viewer for j2k-images, ...")
               ("libsm" ,libsm)
               ("perl" ,perl)))
     (arguments
-     `(#:phases (alist-cons-after
-                 'unpack 'disable-html-doc-gen
-                 (lambda _
-                   (substitute* "doc/Makefile.in"
-                     (("^all: allhtml manpages") "")))
-                 (alist-cons-after
-                  'install 'install-manpages
-                  (lambda* (#:key outputs #:allow-other-keys)
-                    (let* ((bin (assoc-ref outputs "bin"))
-                           (man1dir (string-append bin "/share/man/man1")))
-                      (mkdir-p man1dir)
-                      (for-each (lambda (file)
-                                  (let ((base (basename file)))
-                                    (format #t "installing `~a' to `~a'~%"
-                                            base man1dir)
-                                    (copy-file file
-                                               (string-append
-                                                man1dir "/" base))))
-                                (find-files "doc" "\\.1"))))
-                  %standard-phases))))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-html-doc-gen
+           (lambda _
+             (substitute* "doc/Makefile.in"
+               (("^all: allhtml manpages") ""))))
+         (add-after 'install 'install-manpages
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((bin (assoc-ref outputs "bin"))
+                    (man1dir (string-append bin "/share/man/man1")))
+               (mkdir-p man1dir)
+               (for-each (lambda (file)
+                           (let ((base (basename file)))
+                             (format #t "installing `~a' to `~a'~%"
+                                     base man1dir)
+                             (copy-file file
+                                        (string-append
+                                         man1dir "/" base))))
+                         (find-files "doc" "\\.1"))))))))
     (synopsis "Tools and library for working with GIF images")
     (description
      "GIFLIB is a library for reading and writing GIF images.  It is API and
@@ -391,7 +498,8 @@ compose, and analyze GIF images.")
     (version "4.1.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/giflib/libungif-"
+              (uri (string-append "mirror://sourceforge/giflib/libungif-4.x/"
+                                  "libungif-" version "/libungif-"
                                   version ".tar.bz2"))
               (sha256
                (base32
@@ -407,15 +515,15 @@ compose, and analyze GIF images.")
 (define-public imlib2
   (package
     (name "imlib2")
-    (version "1.4.7")
+    (version "1.4.9")
     (source (origin
               (method url-fetch)
               (uri (string-append
-                    "mirror://sourceforge/enlightenment/imlib2-"
-                    version ".tar.bz2"))
+                    "mirror://sourceforge/enlightenment/imlib2-src/" version
+                    "/imlib2-" version ".tar.bz2"))
               (sha256
                (base32
-                "00a7jbwj10x3jcvxa5rplnkvhv35gv9rb400zy636zdd4g737mrm"))))
+                "08809xxk2555yj6glixzw9a0x3x8cx55imd89kj3r0h152bn8a3x"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkgconfig" ,pkg-config)))
@@ -449,9 +557,13 @@ more modular, simple, and flexible.")
     (version "1.2.4")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "http://linuxbrit.co.uk/downloads/giblib-"
-                    version ".tar.gz"))
+              (uri (list
+                     (string-append
+                       "http://linuxbrit.co.uk/downloads/giblib-"
+                       version ".tar.gz")
+                     (string-append
+                       "https://sourceforge.net/projects/slackbuildsdirectlinks/"
+                       "files/giblib/giblib-" version ".tar.gz")))
               (sha256
                (base32
                 "1b4bmbmj52glq0s898lppkpzxlprq9aav49r06j2wx4dv3212rhp"))))
@@ -473,17 +585,18 @@ supplies a generic doubly-linked list and some string functions.")
 (define-public freeimage
   (package
    (name "freeimage")
-   (version "3.16.0")
+   (version "3.17.0")
    (source (origin
             (method url-fetch)
             (uri (string-append
                   "mirror://sourceforge/freeimage/Source%20Distribution/"
                   version "/FreeImage"
-                  (string-join (string-split version #\.) "")
+                  (string-concatenate (string-split version #\.))
                   ".zip"))
             (sha256
              (base32
-              "0q1gnjnxgphsh4l8i9rfly4bi8xsczsb9ryzbm8hf38lc3fk5bq3"))))
+              "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v"))
+            (patches (search-patches "freeimage-CVE-2015-0852.patch"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases (alist-delete
@@ -511,23 +624,27 @@ graphics image formats like PNG, BMP, JPEG, TIFF and others.")
 (define-public vigra
   (package
    (name "vigra")
-   (version "1.10.0")
+   (version "1.11.0")
    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://hci.iwr.uni-heidelberg.de/vigra/vigra-"
-                           version "-src.tar.gz"))
-       (sha256 (base32
-                 "16d0jvz3k49niljg9qvvlyxxl15yk0300xkymvyznlmvn1hs7m22"))))
+    (origin
+      (method url-fetch)
+      (uri (string-append "https://github.com/ukoethe/vigra/releases/download/"
+                          "Version-1-11-0/vigra-"
+                          version "-src.tar.gz"))
+      (sha256 (base32
+                "1jzm79kqiiilvys3b8mlzy9cvmiirrcwsrlg19qd9rza8zipsqb8"))))
    (build-system cmake-build-system)
    (inputs
     `(("boost" ,boost)
       ("fftw" ,fftw)
       ("fftwf" ,fftwf)
       ("hdf5" ,hdf5)
+      ("ilmbase" ,ilmbase) ; propagated by openexr, but needed explicitly
+                           ; to create a configure-flag
       ("libjpeg" ,libjpeg)
       ("libpng" ,libpng)
       ("libtiff" ,libtiff)
+      ("openexr" ,openexr)
       ("python" ,python-2) ; print syntax
       ("python2-numpy" ,python2-numpy)
       ("zlib" ,zlib)))
@@ -537,11 +654,20 @@ graphics image formats like PNG, BMP, JPEG, TIFF and others.")
       ("python2-sphinx" ,python2-sphinx)))
    (arguments
     `(#:test-target "check"
+      #:parallel-build? #f ; parallel builds trigger an ICE
       #:configure-flags
         (list "-Wno-dev" ; suppress developer mode with lots of warnings
               (string-append "-DVIGRANUMPY_INSTALL_DIR="
                              (assoc-ref %outputs "out")
-                             "/lib/python2.7/site-packages"))))
+                             "/lib/python2.7/site-packages")
+              ;; OpenEXR is not enabled by default.
+              "-DWITH_OPENEXR=1"
+              ;; The header files of ilmbase are not found when included
+              ;; by the header files of openexr, and an explicit flag
+              ;; needs to be set.
+              (string-append "-DCMAKE_CXX_FLAGS=-I"
+                             (assoc-ref %build-inputs "ilmbase")
+                             "/include/OpenEXR"))))
    (synopsis "Computer vision library")
    (description
     "VIGRA stands for Vision with Generic Algorithms.  It is an image
@@ -593,8 +719,8 @@ channels.")
     (version "2.0.3")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libmng/"
-                                  name "-" version ".tar.xz"))
+              (uri (string-append "mirror://sourceforge/libmng/libmng-devel/"
+                                  version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
                 "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija"))))
@@ -609,3 +735,189 @@ channels.")
     (description
      "Libmng is the MNG (Multiple-image Network Graphics) reference library.")
     (license license:bsd-3)))
+
+(define-public devil
+  (package
+    (name "devil")
+    (version "1.7.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://downloads.sourceforge.net/openil/"
+                                  "DevIL-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"))
+              ;; Backported from upstream:
+              ;; https://github.com/DentonW/DevIL/commit/724194d7a9a91221a564579f64bdd6f0abd64219.patch
+              (patches (search-patches "devil-fix-libpng.patch"
+                                       "devil-CVE-2009-3994.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Fix old lcms include directives and lib flags.
+               '(substitute* '("configure" "src-IL/src/il_profiles.c")
+                  (("-llcms") "-llcms2")
+                  (("lcms/lcms\\.h") "lcms2/lcms2.h")
+                  (("lcms\\.h") "lcms2.h")))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:configure-flags '("--enable-ILUT=yes") ; build utility library
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'fix-tests
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Fix hard-coded /bin/bash reference.
+             (substitute* '("test/Makefile")
+               (("TESTS_ENVIRONMENT = /bin/bash")
+                (string-append "TESTS_ENVIRONMENT = "
+                               (assoc-ref inputs "bash")
+                               "/bin/bash")))
+             #t)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("lcms" ,lcms)
+       ("libjpeg" ,libjpeg)
+       ("libmng" ,libmng)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("openexr" ,openexr)
+       ("zlib" ,zlib)))
+    (synopsis "Library for manipulating many image formats")
+    (description "Developer's Image Library (DevIL) is a library to develop
+applications with support for many types of images.  DevIL can load, save,
+convert, manipulate, filter and display a wide variety of image formats.")
+    (home-page "http://openil.sourceforge.net")
+    (license license:lgpl2.1+)))
+
+(define-public jasper
+  (package
+    (name "jasper")
+    (version "1.900.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
+                                  "/software/jasper-" version ".zip"))
+              (sha256
+               (base32
+                "154l7zk7yh3v8l2l6zm5s2alvd2fzkp6c9i18iajfbna5af5m43b"))
+              (patches (search-patches
+                        "jasper-CVE-2007-2721.patch"
+                        "jasper-CVE-2008-3520.patch"
+                        "jasper-CVE-2008-3522.patch"
+                        "jasper-CVE-2011-4516-and-CVE-2011-4517.patch"
+                        "jasper-CVE-2014-8137.patch"
+                        "jasper-CVE-2014-8138.patch"
+                        "jasper-CVE-2014-8157.patch"
+                        "jasper-CVE-2014-8158.patch"
+                        "jasper-CVE-2014-9029.patch"
+                        "jasper-CVE-2016-1577.patch"
+                        "jasper-CVE-2016-1867.patch"
+                        "jasper-CVE-2016-2089.patch"
+                        "jasper-CVE-2016-2116.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (synopsis "JPEG-2000 library")
+    (description "The JasPer Project is an initiative to provide a reference
+implementation of the codec specified in the JPEG-2000 Part-1 standard (i.e.,
+ISO/IEC 15444-1).")
+    (home-page "https://www.ece.uvic.ca/~frodo/jasper/")
+    (license (license:x11-style "file://LICENSE"))))
+
+(define-public zimg
+  (package
+    (name "zimg")
+    (version "2.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/sekrit-twc/zimg/archive/"
+                            "release-" version ".tar.gz"))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "1hqp1gcsa2zhypms5dnasb1srjgxdqm7cip3w5i571kk9nxkn289"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'autogen
+           (lambda _
+             (zero? (system* "sh" "autogen.sh")))))))
+    (synopsis "Scaling, colorspace conversion, and dithering library")
+    (description "Zimg implements the commonly required image processing basics
+of scaling, colorspace conversion, and depth conversion.  A simple API enables
+conversion between any supported formats to operate with minimal knowledge from
+the programmer.")
+    (home-page "https://github.com/sekrit-twc/zimg")
+    ;; test/extra/ contains musl-libm, 
+    ;; which is MIT/expat licensed, but only used for tests
+    (license (license:fsf-free "file://COPYING")))) ;WTFPL version 2
+
+(define-public perceptualdiff
+  (package
+    (name "perceptualdiff")
+    (version "1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/myint/perceptualdiff/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0zl6xmp971fffg7fzcz2fbgxg5x2w7l8qa65c008i4kbkc9016ps"))))
+    (build-system cmake-build-system)
+    (inputs `(("freeimage" ,freeimage)))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'fix-tests
+                    ;; cmake-build-system uses a build/ directory outside
+                    ;; of the source tree, one level higher than expected
+                    (lambda _
+                      (substitute* "test/run_tests.bash"
+                        (("../build") "../../build")))))))
+    (home-page "https://github.com/myint/perceptualdiff")
+    (synopsis "Perceptual image comparison utility")
+    (description "PerceptualDiff visually compares two images to determine
+whether they look alike.  It uses a computational model of the human visual
+system to detect similarities.  This allows it too see beyond irrelevant
+differences in file encoding, image quality, and other small variations.")
+    (license license:gpl2+)))
+
+(define-public steghide
+  (package
+    (name "steghide")
+    (version "0.5.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/steghide/steghide/"
+                                  version "/steghide-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "18bxlhbdc3zsmxj84i417xjh0q28kv26q449k23n0a72ldwziix2"))
+              (patches (list (search-patch "steghide-fixes.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gettext" ,gnu-gettext)
+       ("libtool" ,libtool)
+       ("perl" ,perl)))                 ;for tests
+    (inputs
+     `(("libmhash" ,libmhash)
+       ("libmcrypt" ,libmcrypt)
+       ("libjpeg" ,libjpeg)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:make-flags '("CXXFLAGS=-fpermissive"))) ;required for MHashPP.cc
+    (home-page "http://steghide.sourceforge.net")
+    (synopsis "Image and audio steganography")
+    (description
+     "Steghide is a steganography program that is able to hide data in various
+kinds of image- and audio-files.  The color- respectivly sample-frequencies
+are not changed thus making the embedding resistant against first-order
+statistical tests.")
+    (license license:gpl2+)))