gnu: Add texlive-todonotes.
[jackhill/guix/guix.git] / gnu / packages / image.scm
index 24f1b15..ff434bb 100644 (file)
@@ -11,7 +11,7 @@
 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
-;;; Copyright © 2016, 2017 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2016, 2017, 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2016, 2017 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2017,2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
@@ -25,6 +25,7 @@
 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -74,6 +75,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system scons)
   #:use-module (guix deprecation)
   #:use-module (srfi srfi-1))
 
+(define-public iqa
+  (package
+    (name "iqa")
+    (version "1.1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/iqa/files/"
+                       "1.1.2%20Release/iqa_1.1.2_src.tar.gz/download"))
+       (sha256
+        (base32 "00mgwy031ammab6bwmd1whhvqv3fxy1cs1igabq0n3ag12zhjs77"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib")))
+               (install-file "build/debug/libiqa.a" lib)
+               #t))))))
+    (synopsis "Image Quality Assessment")
+    (description "IQA is a C library for objectively measuring image/video
+quality.  It implements many popular algorithms, such as MS-SSIM, MS-SSIM*,
+SIMM, MSE, and PSNR.  It is designed to be fast, accurate, and reliable.  All
+code is Valgrind-clean and unit tested.")
+    (home-page "https://sourceforge.net/projects/iqa/")
+    (license license:bsd-4)))
+
 (define-public libpng
   (package
    (name "libpng")
@@ -301,16 +336,16 @@ Currently all documentation resides in @file{pnglite.h}.")
 (define-public libimagequant
   (package
     (name "libimagequant")
-    (version "2.12.5")
+    (version "2.12.6")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/ImageOptim/libimagequant.git")
+             (url "https://github.com/ImageOptim/libimagequant")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0cp68w04ja5pv77ssfafsn958w9hh9zb8crrlb5j3gsrcmdc032k"))))
+        (base32 "00w7fny3xf14cfyhbdnmqyh9ddqdh1irvgzxd35a2z65kp7vnvj0"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f))                    ; no check target
@@ -330,7 +365,7 @@ and other PNG optimizers.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/kornelski/pngquant.git")
+             (url "https://github.com/kornelski/pngquant")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -369,13 +404,13 @@ Features:
 (define-public ijg-libjpeg
   (package
    (name "libjpeg")
-   (version "9c")
+   (version "9d")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://www.ijg.org/files/jpegsrc.v"
                    version ".tar.gz"))
             (sha256 (base32
-                     "08kixcf3a7s9x91174abjnk1xbvj4v8crdc73zi4k9h3jfbm00k5"))))
+                     "0clwys9lcqlxqgcw8s1gwfm5ix2zjlqpklmd3mbvqmj5ibj51jwr"))))
    (build-system gnu-build-system)
    (synopsis "Library for handling JPEG files")
    (description
@@ -395,16 +430,6 @@ lossless JPEG manipulations such as rotation, scaling or cropping:
    (license license:ijg)
    (home-page "https://www.ijg.org/")))
 
-(define-public ijg-libjpeg-8
-  (package (inherit ijg-libjpeg)
-   (version "8d")
-   (source (origin
-            (method url-fetch)
-            (uri (string-append "https://www.ijg.org/files/jpegsrc.v"
-                   version ".tar.gz"))
-            (sha256 (base32
-                     "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"))))))
-
 (define-public libjxr
   (package
     (name "libjxr")
@@ -551,7 +576,7 @@ extracting icontainer icon files.")
    (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://download.osgeo.org/libtiff/tiff-"
+       (uri (string-append "https://download.osgeo.org/libtiff/tiff-"
                            version ".tar.gz"))
        (sha256
         (base32
@@ -586,7 +611,7 @@ collection of tools for doing simple manipulations of TIFF images.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/DanBloomberg/leptonica.git")
+             (url "https://github.com/DanBloomberg/leptonica")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -756,6 +781,28 @@ images of initially unknown height.")
     (license (list license:isc          ; pbmtools/p?m.5
                    license:gpl2+))))    ; the rest
 
+(define-public openjpeg-data
+  (package
+    (name "openjpeg-data")
+    (version "2020.05.19")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/uclouvain/openjpeg-data.git")
+         (commit "c5c4a8c")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1jp84gbhw8q5b8mhc322ql9410hjf32w9hg10x4isfa9j59mnncb"))))
+    (build-system copy-build-system)
+    (synopsis "Test files for OpenJPEG")
+    (description "OpenJPEG-Data contains all files required to run the openjpeg
+test suite, including conformance tests (following Rec. ITU-T T.803 | ISO/IEC
+15444-4 procedures), non-regression tests and unit tests.")
+    (home-page "https://github.com/uclouvain/openjpeg-data")
+    (license license:bsd-2)))
+
 (define-public openjpeg
   (package
     (name "openjpeg")
@@ -856,6 +903,55 @@ compose, and analyze GIF images.")
     (home-page "http://giflib.sourceforge.net/")
     (license license:x11)))
 
+(define-public libuemf
+  (package
+    (name "libuemf")
+    (version "0.2.7")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/libuemf/libUEMF-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "05djs99vqf067x81xfpskh7a66y5x7b4mmjavybcy7swnm0swg7v"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Overriding CMAKE_INSTALL_PREFIX is not a good idea.
+         (add-after 'unpack 'fix-CMakeLists.txt
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               ((".*SET\\(CMAKE_INSTALL_PREFIX.*") ""))
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (sources (string-append "../libUEMF-" ,version))
+                    (drm-tools (assoc-ref inputs "drm-tools"))
+                    (extract (string-append drm-tools "/bin/extract"))
+                    (execinput (string-append drm-tools "/bin/execinput")))
+               (with-directory-excursion sources
+                 (substitute* "testit.sh"
+                   (("^EPATH=.*")
+                    (format #f "EPATH=~a~%" bin))
+                   (("`which diff`")
+                    "diff")
+                   (("^EXTRACT=.*")
+                    (format #f "EXTRACT=~a~%" extract))
+                   (("^EXECINPUT=.*")
+                    (format #f "EXECINPUT=~a~%" execinput)))
+                 (invoke "sh" "testit.sh"))))))))
+    (native-inputs `(("drm-tools" ,drm-tools))) ;for tests
+    (home-page "http://libuemf.sourceforge.net/")
+    (synopsis "Library for working with WFM, EMF and EMF+ images")
+    (description "The libUEMF library is a portable C99 implementation for
+reading and writing @acronym{WFM, Windows Metafile}, @acronym{EMF, Enhanced
+Metafile}, and @acronym{EMF+, Enhanced Metafile Plus} files.")
+    (license license:gpl2+)))
+
 (define-public libungif
   (package
     (name "libungif")
@@ -944,7 +1040,7 @@ more modular, simple, and flexible.")
     (home-page
      ;; This vanished page is universally accepted as giblib's home despite not
      ;; mentioning the package once.
-     (string-append "https://web.archive.org/web/20140907071208"
+     (string-append "https://web.archive.org/web/20140907071208/"
                     "https://linuxbrit.co.uk/software/"))
     (synopsis "Wrapper library for imlib2")
     (description
@@ -978,7 +1074,19 @@ supplies a generic doubly-linked list and some string functions.")
                     (delete-file-recursively (string-append "Source/" dir)))
                   '("LibJPEG" "LibOpenJPEG" "LibPNG" "LibRawLite"
                     "LibJXR" "LibWebP" "OpenEXR" "ZLib"))))
-            (patches (search-patches "freeimage-unbundle.patch"))))
+            (patches
+             (append
+              (search-patches "freeimage-unbundle.patch")
+              ;; Take one patch from Arch Linux that adds LibRaw 0.20 compatibility.
+              (list (origin
+                      (method url-fetch)
+                      (uri "https://raw.githubusercontent.com/archlinux\
+/svntogit-community/ca3e6a52f5a46dec87cbf85e9d84fe370e282c8c/trunk\
+/freeimage-libraw-0.20.patch")
+                      (file-name "freeimage-libraw-compat.patch")
+                      (sha256
+                       (base32
+                        "0cwjxjz0f4gs6igvwqg0p99mnrsrwzkal1l2n08yvz2xq9s5khki"))))))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
@@ -1207,14 +1315,14 @@ channels.")
 (define-public exiv2
   (package
     (name "exiv2")
-    (version "0.27.2")
+    (version "0.27.3")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://www.exiv2.org/builds/exiv2-" version
                            "-Source.tar.gz"))
        (sha256
-        (base32 "0gqminvj14xm3rgbnydbywf22608js80rp7nmxxk4497j5mzali6"))))
+        (base32 "0y77wfadjsrcxijdqgkr3q88b6mm9y3rg8kqsmaig8iah49md7x7"))))
     (build-system cmake-build-system)
     (arguments '(#:tests? #f))          ; no test suite
     (propagated-inputs
@@ -1301,17 +1409,29 @@ convert, manipulate, filter and display a wide variety of image formats.")
 (define-public jasper
   (package
     (name "jasper")
-    (version "2.0.16")
+    (version "2.0.20")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/mdadams/jasper.git")
+                    (url "https://github.com/mdadams/jasper")
                     (commit (string-append "version-" version))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "05l75yd1zsxwv25ykwwwjs8961szv7iywf16nc6vc6qpby27ckv6"))))
+                "1bn4mg6l5afryrlyk3y7p3accdq113fis8hpwywy5g51ycablz3h"))))
     (build-system cmake-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-checking-disabled-things
+           (lambda _
+             ;; The MIF codec was disabled for security reasons in JasPer 2.0.20
+             ;; but its test suite still assumes that the format is supported.
+             (for-each delete-file
+                       (find-files "data/test" "\\.mif$")) ; for run_test_1
+             (substitute* "test/bin/run_test_2"
+               (("image_formats\\+=\\(mif\\)") ""))
+             #t)))))
     (inputs `(("libjpeg" ,libjpeg-turbo)))
     (synopsis "JPEG-2000 library")
     (description "The JasPer Project is an initiative to provide a reference
@@ -1328,7 +1448,7 @@ ISO/IEC 15444-1).")
       (origin
         (method git-fetch)
         (uri (git-reference
-              (url "https://github.com/sekrit-twc/zimg.git")
+              (url "https://github.com/sekrit-twc/zimg")
               (commit (string-append "release-" version))))
         (file-name (git-file-name name version))
         (sha256
@@ -1356,7 +1476,7 @@ the programmer.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/myint/perceptualdiff.git")
+             (url "https://github.com/myint/perceptualdiff")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -1430,7 +1550,7 @@ changed, making the embedding resistant against first-order statistical tests.")
       (source
        (origin (method git-fetch)
                (uri (git-reference
-                     (url "https://github.com/extemporelang/stb.git")
+                     (url "https://github.com/extemporelang/stb")
                      (commit commit)))
                (sha256
                 (base32
@@ -1526,6 +1646,7 @@ is hereby granted."))))
   (package
     (name "libjpeg-turbo")
     (version "2.0.4")
+    (replacement libjpeg-turbo/fixed)
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
@@ -1582,6 +1703,18 @@ and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).")
                    license:ijg          ;the libjpeg library and associated tools
                    license:zlib))))     ;the libjpeg-turbo SIMD extensions
 
+(define libjpeg-turbo/fixed
+  (package
+    (inherit libjpeg-turbo)
+    (version "2.0.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
+                                  version "/libjpeg-turbo-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0pbv6pc97kbj7ib31qcwi7lnmm9xg5y3b11aasmkhfjvf7rgdy0n"))))))
+
 (define-deprecated libjpeg libjpeg-turbo)
 (export libjpeg)
 
@@ -1636,7 +1769,7 @@ medical image data, e.g. magnetic resonance image (MRI) and functional MRI
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/thezbyg/gpick.git")
+                    (url "https://github.com/thezbyg/gpick")
                     (commit (string-append name "-" version))))
               (file-name (git-file-name name version))
               (sha256
@@ -1699,7 +1832,7 @@ parsing, viewing, modifying, and saving this metadata.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/lupoDharkael/flameshot.git")
+             (url "https://github.com/lupoDharkael/flameshot")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -1807,16 +1940,16 @@ identical visual appearance.")
 (define-public grim
   (package
    (name "grim")
-   (version "1.2.0")
+   (version "1.3.1")
    (source
     (origin
      (method git-fetch)
      (uri (git-reference
-           (url "https://github.com/emersion/grim.git")
+           (url "https://github.com/emersion/grim")
            (commit (string-append "v" version))))
      (file-name (git-file-name name version))
      (sha256
-      (base32 "0brljl4zfbn5mh9hkfrfkvd27c5y9vdkgap9r1hrfy9r1x20sskn"))))
+      (base32 "0fjmjq0ws9rlblkcqxxw2lv7zvvyi618jqzlnz5z9zb477jwdfib"))))
    (build-system meson-build-system)
    (native-inputs `(("pkg-config" ,pkg-config)
                     ("scdoc" ,scdoc)))
@@ -1838,7 +1971,7 @@ identical visual appearance.")
     (origin
      (method git-fetch)
      (uri (git-reference
-           (url "https://github.com/emersion/slurp.git")
+           (url "https://github.com/emersion/slurp")
            (commit (string-append "v" version))))
      (file-name (git-file-name name version))
      (sha256
@@ -2016,62 +2149,108 @@ This package can be used to create @code{favicon.ico} files for web sites.")
      `(("libaom" ,libaom)
        ("dav1d" ,dav1d)))
     (synopsis "Encode and decode AVIF files")
-    (description "Libavif is a C implementation of the AV1 Image File Format
-(AVIF).  It can encode and decode all YUV formats and bit depths supported by
-AOM, including with alpha.")
+    (description "Libavif is a C implementation of @acronym{AVIF, the AV1 Image
+File Format}.  It can encode and decode all YUV formats and bit depths supported
+by AOM, including with alpha.")
     (home-page "https://github.com/AOMediaCodec/libavif")
     (license (list license:bsd-2    ; libavif itself
                    license:expat)))) ; cJSON in the test suite
 
 (define-public mtpaint
-  (let ((commit "03b1b0938067b88d86d9f1b1088730f1934d411e")
-        (revision "1"))
-    (package
-      (name "mtpaint")
-      ;; The author neither releases tarballs nor uses git version tags.
-      ;; Instead, author puts version in git commit title.
-      (version (git-version "3.49.25" revision commit))
-      (source
-       (origin
-         (method git-fetch)
-         (uri (git-reference
-               (url "https://github.com/wjaguar/mtPaint/")
-               (commit commit)))
-         (file-name (git-file-name name version))
-         (sha256
-          (base32 "0izm2wvj26566fd8mqvypr7bmv7jnq8qhp4760m7z2wrc4y8pjn1"))))
-      (build-system gnu-build-system)
-      (native-inputs
-       `(("gettext" ,gettext-minimal)
-         ("pkg-config" ,pkg-config)
-         ("which" ,which)))
-      (inputs
-       `(("imlib2" ,imlib2)
-         ("libtiff" ,libtiff)
-         ("libpng" ,libpng)
-         ("libungif", libungif)
-         ("libjpeg", libjpeg-turbo)
-         ("libwebp" ,libwebp)
-         ("openjpeg" ,openjpeg)
-         ("lcms" ,lcms)
-         ("zlib", zlib)
-         ("glib" ,glib)
-         ;; support for gtk3 is in testing stage
-         ("gtk+" ,gtk+-2)))
-      (arguments
-       `(#:configure-flags
-         (list
-          ;; internationalized version
-          "intl"
-          ;; install man page
-          "man")
-         ;; no check target
-         #:tests? #f))
-      (home-page "http://mtpaint.sourceforge.net/")
-      (synopsis "Create pixel art and manipulate digital images")
-      (description
-       "Mtpaint is a graphic editing program which uses the GTK+ toolkit.
+  (package
+    (name "mtpaint")
+    ;; The author neither releases tarballs nor uses git version tags.
+    ;; Instead, author puts version in git commit title.
+    (version "3.49.27")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/wjaguar/mtPaint")
+             (commit "26751cd0336414e2f16cbe25c9fe2702f34e7b5c")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "12mzai9pqvyb342m21rjz0jxiy75q24sjw6ax147pzy8frzkgd54"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gettext" ,gettext-minimal)
+       ("pkg-config" ,pkg-config)
+       ("which" ,which)))
+    (inputs
+     `(("imlib2" ,imlib2)
+       ("libtiff" ,libtiff)
+       ("libpng" ,libpng)
+       ("libungif", libungif)
+       ("libjpeg", libjpeg-turbo)
+       ("libwebp" ,libwebp)
+       ("openjpeg" ,openjpeg)
+       ("lcms" ,lcms)
+       ("zlib", zlib)
+       ("glib" ,glib)
+       ;; Support for gtk3 is in the testing stage.
+       ("gtk+" ,gtk+-2)))
+    (arguments
+     `(#:configure-flags
+       (list "intl"                     ; build internationalized version
+             "man")                     ; build the man page
+       #:tests? #f))                    ; no test suite
+    (home-page "http://mtpaint.sourceforge.net/")
+    (synopsis "Create pixel art and manipulate digital images")
+    (description
+     "Mtpaint is a graphic editing program which uses the GTK+ toolkit.
 It can create and edit indexed palette or 24bit RGB images, offers basic
 painting and palette manipulation tools.  It also handles JPEG, JPEG2000,
 GIF, TIFF, WEBP, BMP, PNG, XPM formats.")
-      (license license:gpl3+))))
+    (license license:gpl3+)))
+
+(define-public phockup
+  (package
+    (name "phockup")
+    (version "1.5.9")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ivandokov/phockup")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "13ajj0xch7yfqaaxbw0awxs0fz17n1rxir4gqh2wcgxjysqk1j2y"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("src" "share/phockup/")
+                        ("phockup.py" "share/phockup/"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* (list "src/dependency.py" "src/exif.py")
+               (("exiftool")
+                (string-append (assoc-ref inputs "perl-image-exiftool")
+                               "/bin/exiftool")))
+             #t))
+         (add-before 'install 'check
+           (lambda _
+             (invoke "pytest")))
+         (add-after 'install 'install-bin
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir (string-append out "/bin"))
+               (symlink (string-append out "/share/phockup/phockup.py")
+                        (string-append out "/bin/phockup")))
+             #t)))))
+    (inputs
+     `(("perl-image-exiftool" ,perl-image-exiftool)
+       ("python" ,python)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-pytest-mock" ,python-pytest-mock)))
+    (home-page "https://github.com/ivandokov/phockup")
+    (synopsis "Organize photos and videos in folders")
+    (description "Phockup is a media sorting tool that uses creation date and
+time information in photos and videos to organize them into folders by year,
+month and day.  All files which are not images or videos or those which do not
+have creation date information will be placed in a folder called
+@file{unknown}.")
+    (license license:expat)))