gnu: jbig2dec: Fix CVE-2016-9601.
[jackhill/guix/guix.git] / gnu / packages / image.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
6 ;;; Copyright © 2014, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
8 ;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
9 ;;; Copyright © 2014, 2017 John Darrington <jmd@gnu.org>
10 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
11 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
12 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
13 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
14 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
15 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
16 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
17 ;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages image)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages algebra)
37 #:use-module (gnu packages assembly)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages boost)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages documentation)
42 #:use-module (gnu packages fontutils)
43 ;; To provide gcc@5 and gcc@6, to work around <http://bugs.gnu.org/24703>.
44 #:use-module (gnu packages gcc)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages ghostscript)
47 #:use-module (gnu packages gl)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages graphics)
50 #:use-module (gnu packages maths)
51 #:use-module (gnu packages mcrypt)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages xml)
56 #:use-module (gnu packages xorg)
57 #:use-module (gnu packages zip)
58 #:use-module ((guix licenses) #:prefix license:)
59 #:use-module (guix packages)
60 #:use-module (guix download)
61 #:use-module (guix git-download)
62 #:use-module (guix build-system gnu)
63 #:use-module (guix build-system cmake)
64 #:use-module (srfi srfi-1))
65
66 (define-public libpng
67 (package
68 (name "libpng")
69 (version "1.6.28")
70 (source (origin
71 (method url-fetch)
72 (uri (list (string-append "mirror://sourceforge/libpng/libpng16/"
73 version "/libpng-" version ".tar.xz")
74 (string-append
75 "ftp://ftp.simplesystems.org/pub/libpng/png/src"
76 "/libpng16/libpng-" version ".tar.xz")
77 (string-append
78 "ftp://ftp.simplesystems.org/pub/libpng/png/src/history"
79 "/libpng16/libpng-" version ".tar.xz")))
80 (sha256
81 (base32 "0ylgyx93hnk38haqrh8prd3ax5ngzwvjqw5cxw7p9nxmwsfyrlyq"))))
82 (build-system gnu-build-system)
83
84 ;; libpng.la says "-lz", so propagate it.
85 (propagated-inputs `(("zlib" ,zlib)))
86
87 (synopsis "Library for handling PNG files")
88 (description
89 "Libpng is the official PNG (Portable Network Graphics) reference
90 library. It supports almost all PNG features and is extensible.")
91 (license license:zlib)
92 (home-page "http://www.libpng.org/pub/png/libpng.html")))
93
94 (define-public libpng-apng
95 (package
96 (inherit libpng)
97 (replacement #f) ;libpng's replacement doesn't apply here
98 (name "libpng-apng")
99 (version (package-version libpng))
100 (arguments
101 `(#:phases
102 (modify-phases %standard-phases
103 (add-after 'unpack 'patch-apng
104 (lambda* (#:key inputs #:allow-other-keys)
105 (define (apply-patch file)
106 (zero? (system* "patch" "-p1" "--force"
107 "--input" file)))
108 (let ((apng.gz (assoc-ref inputs "apng")))
109 (format #t "Applying APNG patch '~a'...~%"
110 apng.gz)
111 (system (string-append "gunzip < " apng.gz " > the-patch"))
112 (and (apply-patch "the-patch")
113 (for-each apply-patch
114 (find-files "\\.patch"))))
115 #t))
116 (add-before 'configure 'no-checks
117 (lambda _
118 (substitute* "Makefile.in"
119 (("^scripts/symbols.chk") "")
120 (("check: scripts/symbols.chk") ""))
121 #t)))))
122 (inputs
123 `(("apng" ,(origin
124 (method url-fetch)
125 (uri
126 (string-append "mirror://sourceforge/libpng-apng/libpng16/"
127 version "/libpng-" version "-apng.patch.gz"))
128 (sha256
129 (base32
130 "026r0gbkf6d6v54wca02cdxln8sj4m2c1yk62sj2aasv2ki2ffh5"))))))
131 (native-inputs
132 `(("libtool" ,libtool)))
133 (synopsis "APNG patch for libpng")
134 (description
135 "APNG (Animated Portable Network Graphics) is an unofficial
136 extension of the APNG (Portable Network Graphics) format.
137 APNG patch provides APNG support to libpng.")
138 (home-page "https://sourceforge.net/projects/libpng-apng/")))
139
140 (define-public libpng-1.2
141 (package
142 (inherit libpng)
143 (version "1.2.57")
144 (source
145 (origin
146 (method url-fetch)
147 (uri (list (string-append "mirror://sourceforge/libpng/libpng12/"
148 version "/libpng-" version ".tar.xz")
149 (string-append
150 "ftp://ftp.simplesystems.org/pub/libpng/png/src"
151 "/libpng12/libpng-" version ".tar.xz")
152 (string-append
153 "ftp://ftp.simplesystems.org/pub/libpng/png/src/history"
154 "/libpng12/libpng-" version ".tar.xz")))
155 (sha256
156 (base32 "1n2lrzjkm5jhfg2bs10q398lkwbbx742fi27zgdgx0x23zhj0ihg"))))))
157
158 (define-public libjpeg
159 (package
160 (name "libjpeg")
161 (version "9b")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append "http://www.ijg.org/files/jpegsrc.v"
165 version ".tar.gz"))
166 (sha256 (base32
167 "0lnhpahgdwlrkd41lx6cr90r199f8mc6ydlh7jznj5klvacd63r4"))))
168 (build-system gnu-build-system)
169 (synopsis "Library for handling JPEG files")
170 (description
171 "Libjpeg implements JPEG image encoding, decoding, and transcoding.
172 JPEG is a standardized compression method for full-color and gray-scale
173 images.
174 The included programs provide conversion between the JPEG format and
175 image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.")
176 (license license:ijg)
177 (home-page "http://www.ijg.org/")))
178
179 (define-public libjpeg-8
180 (package (inherit libjpeg)
181 (version "8d")
182 (source (origin
183 (method url-fetch)
184 (uri (string-append "http://www.ijg.org/files/jpegsrc.v"
185 version ".tar.gz"))
186 (sha256 (base32
187 "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"))))))
188
189 (define-public libjxr
190 (package
191 (name "libjxr")
192 (version "1.1")
193 (source (origin
194 ;; We are using the Debian source because CodePlex does not
195 ;; deliver an easily downloadable tarball.
196 (method url-fetch)
197 (uri (string-append "mirror://debian/pool/main/j/jxrlib/jxrlib_"
198 version ".orig.tar.gz"))
199 (sha256
200 (base32
201 "00w3f3cmjsm3fiaxq5mxskmp5rl3mki8psrf9y8s1vqbg237na67"))
202 (patch-flags '("-p1" "--binary"))
203 (patches (search-patches "libjxr-fix-function-signature.patch"
204 "libjxr-fix-typos.patch"))))
205 (build-system gnu-build-system)
206 (arguments '(#:make-flags '("CC=gcc")
207 #:tests? #f ; no check target
208 #:phases
209 (modify-phases %standard-phases
210 (delete 'configure) ; no configure script
211 ;; The upstream makefile does not include an install phase.
212 (replace 'install
213 (lambda* (#:key outputs #:allow-other-keys)
214 (let* ((out (assoc-ref outputs "out"))
215 (bin (string-append out "/bin"))
216 (lib (string-append out "/lib"))
217 (include (string-append out "/include/jxrlib")))
218 (for-each (lambda (file)
219 (install-file file include)
220 (delete-file file))
221 (append
222 '("jxrgluelib/JXRGlue.h"
223 "jxrgluelib/JXRMeta.h"
224 "jxrtestlib/JXRTest.h"
225 "image/sys/windowsmediaphoto.h")
226 (find-files "common/include" "\\.h$")))
227 (for-each (lambda (file)
228 (install-file file lib)
229 (delete-file file))
230 (find-files "." "\\.a$"))
231 (for-each (lambda (file)
232 (install-file file bin)
233 (delete-file file))
234 '("JxrDecApp" "JxrEncApp")))
235 #t)))))
236 (synopsis "Implementation of the JPEG XR standard")
237 (description "JPEG XR is an approved ISO/IEC International standard (its
238 official designation is ISO/IEC 29199-2). This library is an implementation of that standard.")
239 (license
240 (license:non-copyleft
241 "file://Makefile"
242 "See the header of the Makefile in the distribution."))
243 (home-page "https://jxrlib.codeplex.com/")))
244
245 (define-public jpegoptim
246 (package
247 (name "jpegoptim")
248 (version "1.4.4")
249 (source (origin
250 (method url-fetch)
251 (uri (string-append "http://www.kokkonen.net/tjko/src/jpegoptim-"
252 version ".tar.gz"))
253 (sha256 (base32
254 "1cn1i0g1xjdwa12w0ifbnzgb1vqbpr8ji6h05vxksj79vyi3x849"))))
255 (build-system gnu-build-system)
256 (inputs `(("libjpeg" ,libjpeg)))
257 (arguments
258 ;; no tests
259 '(#:tests? #f))
260 (synopsis "Optimize JPEG images")
261 (description
262 "jpegoptim provides lossless optimization (based on optimizing
263 the Huffman tables) and \"lossy\" optimization based on setting
264 maximum quality factor.")
265 (license license:gpl2+)
266 (home-page "http://www.kokkonen.net/tjko/projects.html#jpegoptim")))
267
268 (define-public libicns
269 (package
270 (name "libicns")
271 (version "0.8.1")
272 (source (origin
273 (method url-fetch)
274 (uri (string-append
275 "mirror://sourceforge/icns/"
276 "libicns-" version ".tar.gz"))
277 (sha256
278 (base32
279 "1hjm8lwap7bjyyxsyi94fh5817xzqhk4kb5y0b7mb6675xw10prk"))))
280 (build-system gnu-build-system)
281 (inputs
282 `(("libpng" ,libpng)
283 ("jasper" ,jasper)))
284 (arguments
285 `(#:tests? #t)) ; No tests.
286 (home-page "http://icns.sourceforge.net/")
287 (synopsis "Library for handling Mac OS icns resource files")
288 (description
289 "Libicns is a library for the manipulation of Mac OS IconFamily resource
290 type files (ICNS). @command{icns2png} and @command{png2icns} are provided to
291 convert between PNG and ICNS. @command{icns2png} will extract image files from
292 ICNS files under names like \"Foo_48x48x32.png\" useful for installing for use
293 with .desktop files. Additionally, @command{icontainer2png} is provided for
294 extracting icontainer icon files.")
295 (license (list license:lgpl2.1+ ; libicns
296 license:lgpl2.0+ ; src/apidocs.*
297 license:gpl2+)))) ; icns2png, png2icns, icontainer2png
298
299 (define-public libtiff
300 (package
301 (name "libtiff")
302 (version "4.0.7")
303 (source (origin
304 (method url-fetch)
305 (uri (string-append "ftp://download.osgeo.org/libtiff/tiff-"
306 version ".tar.gz"))
307 (patches (search-patches "libtiff-heap-overflow-tiffcp.patch"
308 "libtiff-null-dereference.patch"
309 "libtiff-heap-overflow-tif-dirread.patch"
310 "libtiff-heap-overflow-pixarlog-luv.patch"
311 "libtiff-divide-by-zero.patch"
312 "libtiff-divide-by-zero-ojpeg.patch"
313 "libtiff-tiffcp-underflow.patch"
314 "libtiff-invalid-read.patch"
315 "libtiff-CVE-2016-10092.patch"
316 "libtiff-heap-overflow-tiffcrop.patch"
317 "libtiff-divide-by-zero-tiffcrop.patch"
318 "libtiff-CVE-2016-10093.patch"
319 "libtiff-divide-by-zero-tiffcp.patch"
320 "libtiff-assertion-failure.patch"
321 "libtiff-CVE-2016-10094.patch"
322 "libtiff-CVE-2017-5225.patch"))
323 (sha256
324 (base32
325 "06ghqhr4db1ssq0acyyz49gr8k41gzw6pqb6mbn5r7jqp77s4hwz"))))
326 (build-system gnu-build-system)
327 (outputs '("out"
328 "doc")) ;1.3 MiB of HTML documentation
329 (arguments
330 ;; Instead of using --docdir, this package has its own --with-docdir.
331 `(#:configure-flags (list (string-append "--with-docdir="
332 (assoc-ref %outputs "doc")
333 "/share/doc/"
334 ,name "-" ,version))))
335 ;; Build with a patched GCC to work around <http://bugs.gnu.org/24703>.
336 (native-inputs
337 `(("gcc@5" ,gcc-5)))
338 (inputs `(("zlib" ,zlib)
339 ("libjpeg" ,libjpeg)))
340 (synopsis "Library for handling TIFF files")
341 (description
342 "Libtiff provides support for the Tag Image File Format (TIFF), a format
343 used for storing image data.
344 Included are a library, libtiff, for reading and writing TIFF and a small
345 collection of tools for doing simple manipulations of TIFF images.")
346 (license (license:non-copyleft "file://COPYRIGHT"
347 "See COPYRIGHT in the distribution."))
348 (home-page "http://www.simplesystems.org/libtiff/")))
349
350 (define-public libwmf
351 (package
352 (name "libwmf")
353 (version "0.2.8.4")
354 (source
355 (origin
356 (method url-fetch)
357 (uri (string-append "mirror://sourceforge/wvware/"
358 name "/" version
359 "/" name "-" version ".tar.gz"))
360 (sha256
361 (base32 "1y3wba4q8pl7kr51212jwrsz1x6nslsx1gsjml1x0i8549lmqd2v"))
362 (patches
363 (search-patches "libwmf-CAN-2004-0941.patch"
364 "libwmf-CVE-2006-3376.patch"
365 "libwmf-CVE-2007-0455.patch"
366 "libwmf-CVE-2007-2756.patch"
367 "libwmf-CVE-2007-3472.patch"
368 "libwmf-CVE-2007-3473.patch"
369 "libwmf-CVE-2007-3477.patch"
370 "libwmf-CVE-2009-1364.patch"
371 "libwmf-CVE-2009-3546.patch"
372 "libwmf-CVE-2015-0848+CVE-2015-4588.patch"
373 "libwmf-CVE-2015-4695.patch"
374 "libwmf-CVE-2015-4696.patch"))))
375
376 (build-system gnu-build-system)
377 (inputs
378 `(("freetype" ,freetype)
379 ("libjpeg" ,libjpeg)
380 ("libpng",libpng)
381 ("libxml2" ,libxml2)
382 ("zlib" ,zlib)))
383 (native-inputs
384 `(("pkg-config" ,pkg-config)))
385 (synopsis "Library for reading images in the Microsoft WMF format")
386 (description
387 "libwmf is a library for reading vector images in Microsoft's native
388 Windows Metafile Format (WMF) and for either (a) displaying them in, e.g., an X
389 window; or (b) converting them to more standard/free file formats such as, e.g.,
390 the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
391 (home-page "http://wvware.sourceforge.net/libwmf.html")
392
393 ;; 'COPYING' is the GPLv2, but file headers say LGPLv2.0+.
394 (license license:lgpl2.0+)))
395
396 (define-public leptonica
397 (package
398 (name "leptonica")
399 (version "1.74.0")
400 (source
401 (origin
402 (method url-fetch)
403 (uri (string-append
404 "https://github.com/DanBloomberg/leptonica/archive/" version
405 ".tar.gz"))
406 (file-name (string-append "leptonica-" version ".tar.gz"))
407 (sha256
408 (base32 "0i2a4vx9gizki0wgmv03xjz8j9d8agkvbag1a8m4kcw4asd4p87g"))))
409 (build-system gnu-build-system)
410 (native-inputs
411 `(("gnuplot" ,gnuplot) ;needed for test suite
412 ("autoconf" ,autoconf)
413 ("automake" ,automake)
414 ("libtool" ,libtool)
415 ("pkg-config" ,pkg-config)))
416 (inputs
417 `(("giflib" ,giflib)
418 ("libjpeg" ,libjpeg)
419 ("libpng" ,libpng)
420 ("libtiff" ,libtiff)
421 ("libwebp" ,libwebp)))
422 (propagated-inputs
423 ;; Linking a program with leptonica also requires these.
424 `(("openjpeg" ,openjpeg)
425 ("zlib" ,zlib)))
426 (arguments
427 '(#:phases
428 (modify-phases %standard-phases
429 (add-after 'unpack 'autogen
430 (lambda _
431 (zero? (system* "sh" "autobuild"))))
432 (add-after 'unpack 'patch-reg-wrapper
433 (lambda _
434 (substitute* "prog/reg_wrapper.sh"
435 ((" /bin/sh ")
436 (string-append " " (which "sh") " "))
437 (("which gnuplot")
438 "true")))))))
439 (home-page "http://www.leptonica.com/")
440 (synopsis "Library and tools for image processing and analysis")
441 (description
442 "Leptonica is a C library and set of command-line tools for efficient
443 image processing and image analysis operations. It supports rasterop, affine
444 transformations, binary and grayscale morphology, rank order, and convolution,
445 seedfill and connected components, image transformations combining changes in
446 scale and pixel depth, and pixelwise masking, blending, enhancement, and
447 arithmetic ops.")
448 (license license:bsd-2)))
449
450 (define-public jbig2dec
451 (package
452 (name "jbig2dec")
453 (version "0.13")
454 (source
455 (origin
456 (method url-fetch)
457 (uri (string-append "http://downloads.ghostscript.com/public/" name "/"
458 name "-" version ".tar.gz"))
459 (sha256
460 (base32 "04akiwab8iy5iy34razcvh9mcja9wy737civ3sbjxk4j143s1b2s"))
461 (patches (search-patches "jbig2dec-ignore-testtest.patch"
462 "jbig2dec-CVE-2016-9601.patch"))))
463
464 (build-system gnu-build-system)
465 (synopsis "Decoder of the JBIG2 image compression format")
466 (description
467 "JBIG2 is designed for lossy or lossless encoding of 'bilevel' (1-bit
468 monochrome) images at moderately high resolution, and in particular scanned
469 paper documents. In this domain it is very efficient, offering compression
470 ratios on the order of 100:1.
471
472 This is a decoder only implementation, and currently is in the alpha
473 stage, meaning it doesn't completely work yet. However, it is
474 maintaining parity with available encoders, so it is useful for real
475 work.")
476 (home-page "http://www.ghostscript.com/jbig2dec.html")
477 (license license:gpl2+)))
478
479 (define-public openjpeg
480 (package
481 (name "openjpeg")
482 (version "2.1.2")
483 (source
484 (origin
485 (method url-fetch)
486 (uri
487 (string-append "https://github.com/uclouvain/openjpeg/archive/v"
488 version ".tar.gz"))
489 (file-name (string-append name "-" version ".tar.gz"))
490 (sha256
491 (base32
492 "19yz4g0c45sm8y1z01j9djsrl1mkz3pmw7fykc6hkvrqymp7prsc"))
493 (patches (search-patches "openjpeg-CVE-2016-9850-CVE-2016-9851.patch"
494 "openjpeg-CVE-2016-9572-CVE-2016-9573.patch"))))
495 (build-system cmake-build-system)
496 (arguments
497 ;; Trying to run `$ make check' results in a no rule fault.
498 '(#:tests? #f))
499 (inputs
500 `(("lcms" ,lcms)
501 ("libpng" ,libpng)
502 ("libtiff" ,libtiff)
503 ("zlib" ,zlib)))
504 (synopsis "JPEG 2000 codec")
505 (description
506 "The OpenJPEG library is a JPEG 2000 codec written in C. It has
507 been developed in order to promote the use of JPEG 2000, the new
508 still-image compression standard from the Joint Photographic Experts
509 Group (JPEG).
510
511 In addition to the basic codec, various other features are under
512 development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats,
513 an indexing tool useful for the JPIP protocol, JPWL-tools for
514 error-resilience, a Java-viewer for j2k-images, ...")
515 (home-page "https://github.com/uclouvain/openjpeg")
516 (license license:bsd-2)))
517
518 (define-public openjpeg-1
519 (package (inherit openjpeg)
520 (name "openjpeg")
521 (version "1.5.2")
522 (source
523 (origin
524 (method url-fetch)
525 (uri
526 (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
527 name "-" version ".tar.gz"))
528 (sha256
529 (base32 "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm"))))))
530
531 (define-public giflib
532 (package
533 (name "giflib")
534 (version "5.1.4")
535 (source (origin
536 (method url-fetch)
537 (uri (string-append "mirror://sourceforge/giflib/giflib-"
538 version ".tar.bz2"))
539 (sha256
540 (base32
541 "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))))
542 (build-system gnu-build-system)
543 (outputs '("bin" ; utility programs
544 "out")) ; library
545 (inputs `(("libx11" ,libx11)
546 ("libice" ,libice)
547 ("libsm" ,libsm)
548 ("perl" ,perl)))
549 (arguments
550 `(#:phases
551 (modify-phases %standard-phases
552 (add-after 'unpack 'disable-html-doc-gen
553 (lambda _
554 (substitute* "doc/Makefile.in"
555 (("^all: allhtml manpages") ""))))
556 (add-after 'install 'install-manpages
557 (lambda* (#:key outputs #:allow-other-keys)
558 (let* ((bin (assoc-ref outputs "bin"))
559 (man1dir (string-append bin "/share/man/man1")))
560 (mkdir-p man1dir)
561 (for-each (lambda (file)
562 (let ((base (basename file)))
563 (format #t "installing `~a' to `~a'~%"
564 base man1dir)
565 (copy-file file
566 (string-append
567 man1dir "/" base))))
568 (find-files "doc" "\\.1"))))))))
569 (synopsis "Tools and library for working with GIF images")
570 (description
571 "GIFLIB is a library for reading and writing GIF images. It is API and
572 ABI compatible with libungif which was in wide use while the LZW compression
573 algorithm was patented. Tools are also included to convert, manipulate,
574 compose, and analyze GIF images.")
575 (home-page "http://giflib.sourceforge.net/")
576 (license license:x11)))
577
578 (define-public libungif
579 (package
580 (name "libungif")
581 (version "4.1.4")
582 (source (origin
583 (method url-fetch)
584 (uri (string-append "mirror://sourceforge/giflib/libungif-4.x/"
585 "libungif-" version "/libungif-"
586 version ".tar.bz2"))
587 (sha256
588 (base32
589 "0cnksimmmjngdrys302ik1385sg1sj4i0gxivzldhgwd46n7x2kh"))))
590 (build-system gnu-build-system)
591 (inputs `(("perl" ,perl))) ;package ships some perl tools
592 (home-page "http://giflib.sourceforge.net/")
593 (synopsis "GIF decompression library")
594 (description
595 "libungif is the old GIF decompression library by the GIFLIB project.")
596 (license license:expat)))
597
598 (define-public imlib2
599 (package
600 (name "imlib2")
601 (version "1.4.9")
602 (source (origin
603 (method url-fetch)
604 (uri (string-append
605 "mirror://sourceforge/enlightenment/imlib2-src/" version
606 "/imlib2-" version ".tar.bz2"))
607 (sha256
608 (base32
609 "08809xxk2555yj6glixzw9a0x3x8cx55imd89kj3r0h152bn8a3x"))))
610 (build-system gnu-build-system)
611 (native-inputs
612 `(("pkgconfig" ,pkg-config)))
613 (inputs
614 `(("libx11" ,libx11)
615 ("libxext" ,libxext)
616 ("freetype" ,freetype)
617 ("libjpeg" ,libjpeg)
618 ("libpng" ,libpng)
619 ("libtiff" ,libtiff)
620 ("giflib" ,giflib)
621 ("bzip2" ,bzip2)))
622 (home-page "https://sourceforge.net/projects/enlightenment/")
623 (synopsis
624 "Loading, saving, rendering and manipulating image files")
625 (description
626 "Imlib2 is a library that does image file loading and saving as well as
627 rendering, manipulation, arbitrary polygon support, etc.
628
629 It does ALL of these operations FAST. Imlib2 also tries to be highly
630 intelligent about doing them, so writing naive programs can be done easily,
631 without sacrificing speed.
632
633 This is a complete rewrite over the Imlib 1.x series. The architecture is
634 more modular, simple, and flexible.")
635 (license license:imlib2)))
636
637 (define-public giblib
638 (package
639 (name "giblib")
640 (version "1.2.4")
641 (source (origin
642 (method url-fetch)
643 (uri (list
644 (string-append
645 "http://linuxbrit.co.uk/downloads/giblib-"
646 version ".tar.gz")
647 (string-append
648 "https://sourceforge.net/projects/slackbuildsdirectlinks/"
649 "files/giblib/giblib-" version ".tar.gz")))
650 (sha256
651 (base32
652 "1b4bmbmj52glq0s898lppkpzxlprq9aav49r06j2wx4dv3212rhp"))))
653 (build-system gnu-build-system)
654 (inputs
655 `(("libx11" ,libx11)
656 ("imlib2" ,imlib2)))
657 (home-page "http://linuxbrit.co.uk/software/") ; no real home-page
658 (synopsis "Wrapper library for imlib2")
659 (description
660 "Giblib is a simple library which wraps imlib2's context API, avoiding
661 all the context_get/set calls, adds fontstyles to the truetype renderer and
662 supplies a generic doubly-linked list and some string functions.")
663 ;; This license removes a clause about X Consortium from the original
664 ;; X11 license.
665 (license (license:x11-style "file://COPYING"
666 "See 'COPYING' in the distribution."))))
667
668 (define-public freeimage
669 (package
670 (name "freeimage")
671 (version "3.17.0")
672 (source (origin
673 (method url-fetch)
674 (uri (string-append
675 "mirror://sourceforge/freeimage/Source%20Distribution/"
676 version "/FreeImage"
677 (string-concatenate (string-split version #\.))
678 ".zip"))
679 (sha256
680 (base32
681 "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v"))
682 (patches (search-patches "freeimage-CVE-2015-0852.patch"
683 "freeimage-CVE-2016-5684.patch"
684 "freeimage-fix-build-with-gcc-5.patch"))))
685 (build-system gnu-build-system)
686 (arguments
687 '(#:phases
688 (modify-phases %standard-phases
689 (delete 'configure)
690 (add-before 'build 'patch-makefile
691 (lambda* (#:key outputs #:allow-other-keys)
692 (substitute* "Makefile.gnu"
693 (("/usr") (assoc-ref outputs "out"))
694 (("-o root -g root") ""))
695 #t)))
696 #:make-flags '("CC=gcc")
697 #:tests? #f)) ; no check target
698 (native-inputs
699 `(("unzip" ,unzip)))
700 ;; Fails to build on MIPS due to assembly code in the source.
701 (supported-systems (delete "mips64el-linux" %supported-systems))
702 (synopsis "Library for handling popular graphics image formats")
703 (description
704 "FreeImage is a library for developers who would like to support popular
705 graphics image formats like PNG, BMP, JPEG, TIFF and others.")
706 (license license:gpl2+)
707 (home-page "http://freeimage.sourceforge.net")))
708
709 (define-public vigra
710 (package
711 (name "vigra")
712 (version "1.11.0")
713 (source
714 (origin
715 (method url-fetch)
716 (uri (string-append "https://github.com/ukoethe/vigra/releases/download/"
717 "Version-1-11-0/vigra-"
718 version "-src.tar.gz"))
719 (sha256 (base32
720 "1jzm79kqiiilvys3b8mlzy9cvmiirrcwsrlg19qd9rza8zipsqb8"))))
721 (build-system cmake-build-system)
722 (inputs
723 `(("boost" ,boost)
724 ("fftw" ,fftw)
725 ("fftwf" ,fftwf)
726 ("hdf5" ,hdf5)
727 ("ilmbase" ,ilmbase) ; propagated by openexr, but needed explicitly
728 ; to create a configure-flag
729 ("libjpeg" ,libjpeg)
730 ("libpng" ,libpng)
731 ("libtiff" ,libtiff)
732 ("openexr" ,openexr)
733 ("python" ,python-2) ; print syntax
734 ("python2-numpy" ,python2-numpy)
735 ("zlib" ,zlib)))
736 (native-inputs
737 `(("doxygen" ,doxygen)
738 ("python2-nose" ,python2-nose)
739 ("python2-sphinx" ,python2-sphinx)))
740 (arguments
741 `(#:test-target "check"
742 #:parallel-build? #f ; parallel builds trigger an ICE
743 #:configure-flags
744 (list "-Wno-dev" ; suppress developer mode with lots of warnings
745 (string-append "-DVIGRANUMPY_INSTALL_DIR="
746 (assoc-ref %outputs "out")
747 "/lib/python2.7/site-packages")
748 ;; OpenEXR is not enabled by default.
749 "-DWITH_OPENEXR=1"
750 ;; Fix rounding error on 32-bit machines
751 "-DCMAKE_C_FLAGS=-ffloat-store"
752 ;; The header files of ilmbase are not found when included
753 ;; by the header files of openexr, and an explicit flag
754 ;; needs to be set.
755 (string-append "-DCMAKE_CXX_FLAGS=-I"
756 (assoc-ref %build-inputs "ilmbase")
757 "/include/OpenEXR"
758 " -ffloat-store"))))
759 (synopsis "Computer vision library")
760 (description
761 "VIGRA stands for Vision with Generic Algorithms. It is an image
762 processing and analysis library that puts its main emphasis on customizable
763 algorithms and data structures. It is particularly strong for
764 multi-dimensional image processing.")
765 (license license:expat)
766 (home-page "https://hci.iwr.uni-heidelberg.de/vigra")))
767
768 (define-public libwebp
769 (package
770 (name "libwebp")
771 (version "0.6.0")
772 (source
773 (origin
774 (method url-fetch)
775 (uri (string-append
776 "http://downloads.webmproject.org/releases/webp/libwebp-" version
777 ".tar.gz"))
778 (sha256
779 (base32
780 "0h1brwkyxc7lb8lc53aacdks5vc1y9hzngqi41gg7y6l56912a69"))))
781 (build-system gnu-build-system)
782 (inputs
783 `(("freeglut" ,freeglut)
784 ("giflib" ,giflib)
785 ("libjpeg" ,libjpeg)
786 ("libpng" ,libpng)
787 ("libtiff" ,libtiff)))
788 (arguments
789 '(#:configure-flags '("--enable-libwebpmux"
790 "--enable-libwebpdemux"
791 "--enable-libwebpdecoder")))
792 (home-page "https://developers.google.com/speed/webp/")
793 (synopsis "Lossless and lossy image compression")
794 (description
795 "WebP is a new image format that provides lossless and lossy compression
796 for images. WebP lossless images are 26% smaller in size compared to
797 PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at
798 equivalent SSIM index. WebP supports lossless transparency (also known as
799 alpha channel) with just 22% additional bytes. Transparency is also supported
800 with lossy compression and typically provides 3x smaller file sizes compared
801 to PNG when lossy compression is acceptable for the red/green/blue color
802 channels.")
803 (license license:bsd-3)))
804
805 (define-public libmng
806 (package
807 (name "libmng")
808 (version "2.0.3")
809 (source (origin
810 (method url-fetch)
811 (uri (string-append "mirror://sourceforge/libmng/libmng-devel/"
812 version "/" name "-" version ".tar.xz"))
813 (sha256
814 (base32
815 "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija"))))
816 (build-system gnu-build-system)
817 (propagated-inputs
818 ;; These are all in the 'Libs.private' field of libmng.pc.
819 `(("lcms" ,lcms)
820 ("libjpeg" ,libjpeg)
821 ("zlib" ,zlib)))
822 (home-page "http://www.libmng.com/")
823 (synopsis "Library for handling MNG files")
824 (description
825 "Libmng is the MNG (Multiple-image Network Graphics) reference library.")
826 (license license:bsd-3)))
827
828 (define-public exiv2
829 (package
830 (name "exiv2")
831 (version "0.25")
832 (source (origin
833 (method url-fetch)
834 (uri (list (string-append "http://www.exiv2.org/exiv2-"
835 version ".tar.gz")
836 (string-append "https://fossies.org/linux/misc/exiv2-"
837 version ".tar.gz")))
838 (sha256
839 (base32
840 "197g6vgcpyf9p2cwn5p5hb1r714xsk1v4p96f5pv1z8mi9vzq2y8"))))
841 (build-system gnu-build-system)
842 (arguments '(#:tests? #f)) ; no `check' target
843 (propagated-inputs
844 `(("expat" ,expat)
845 ("zlib" ,zlib)))
846 (native-inputs
847 `(("intltool" ,intltool)))
848 (home-page "http://www.exiv2.org/")
849 (synopsis "Library and command-line utility to manage image metadata")
850 (description
851 "Exiv2 is a C++ library and a command line utility to manage image
852 metadata. It provides fast and easy read and write access to the Exif, IPTC
853 and XMP metadata of images in various formats.")
854
855 ;; Files under `xmpsdk' are a copy of Adobe's XMP SDK, licensed under the
856 ;; 3-clause BSD license: <http://www.adobe.com/devnet/xmp/sdk/eula.html>.
857 ;; The core is GPLv2+:
858 ;; <https://launchpad.net/ubuntu/precise/+source/exiv2/+copyright>.
859 (license license:gpl2+)))
860
861 (define-public devil
862 (package
863 (name "devil")
864 (version "1.8.0")
865 (source (origin
866 (method url-fetch)
867 (uri (string-append "http://downloads.sourceforge.net/openil/"
868 "DevIL-" version ".tar.gz"))
869 (sha256
870 (base32
871 "02dpzvi493r09c9hfjnk54nladl3qw55iqkkg18g12fxwwz9fx80"))))
872 (build-system cmake-build-system)
873 (arguments
874 '(;; XXX: Not supported in the released CMakeLists.txt.
875 ;; Enable this for > 1.8.0.
876 #:tests? #f
877 #:phases
878 (modify-phases %standard-phases
879 (add-before 'configure 'change-directory
880 (lambda _ (chdir "DevIL") #t)))))
881 (native-inputs
882 `(("pkg-config" ,pkg-config)))
883 (inputs
884 `(("lcms" ,lcms)
885 ("libjpeg" ,libjpeg-turbo)
886 ("libmng" ,libmng)
887 ("libpng" ,libpng)
888 ("libtiff" ,libtiff)
889 ("openexr" ,openexr)
890 ("zlib" ,zlib)))
891 (synopsis "Library for manipulating many image formats")
892 (description "Developer's Image Library (DevIL) is a library to develop
893 applications with support for many types of images. DevIL can load, save,
894 convert, manipulate, filter and display a wide variety of image formats.")
895 (home-page "http://openil.sourceforge.net")
896 (license license:lgpl2.1+)))
897
898 (define-public jasper
899 (package
900 (name "jasper")
901 (version "2.0.12")
902 (source (origin
903 (method url-fetch)
904 (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
905 "/software/jasper-" version ".tar.gz"))
906 (sha256
907 (base32
908 "1njdbxv7d4anzrd476wjww2qsi96dd8vfnp4hri0srrqxpszl92v"))))
909 (build-system cmake-build-system)
910 (inputs `(("libjpeg" ,libjpeg)))
911 (synopsis "JPEG-2000 library")
912 (description "The JasPer Project is an initiative to provide a reference
913 implementation of the codec specified in the JPEG-2000 Part-1 standard (i.e.,
914 ISO/IEC 15444-1).")
915 (home-page "https://www.ece.uvic.ca/~frodo/jasper/")
916 (license (license:x11-style "file://LICENSE"))))
917
918 (define-public zimg
919 (package
920 (name "zimg")
921 (version "2.5")
922 (source
923 (origin
924 (method url-fetch)
925 (uri (string-append "https://github.com/sekrit-twc/zimg/archive/"
926 "release-" version ".tar.gz"))
927 (file-name (string-append name "-" version ".tar.gz"))
928 (sha256
929 (base32
930 "0kbq2dy659645fmgxpzg38b6y6x82kwkydhc380kdkaikv2brcjh"))))
931 (build-system gnu-build-system)
932 (native-inputs
933 `(("autoconf" ,autoconf)
934 ("automake" ,automake)
935 ("libtool" ,libtool)))
936 (arguments
937 '(#:phases
938 (modify-phases %standard-phases
939 (add-after 'unpack 'autogen
940 (lambda _
941 (zero? (system* "sh" "autogen.sh")))))))
942 (synopsis "Scaling, colorspace conversion, and dithering library")
943 (description "Zimg implements the commonly required image processing basics
944 of scaling, colorspace conversion, and depth conversion. A simple API enables
945 conversion between any supported formats to operate with minimal knowledge from
946 the programmer.")
947 (home-page "https://github.com/sekrit-twc/zimg")
948 ;; test/extra/ contains musl-libm,
949 ;; which is MIT/expat licensed, but only used for tests
950 (license (license:fsf-free "file://COPYING")))) ;WTFPL version 2
951
952 (define-public perceptualdiff
953 (package
954 (name "perceptualdiff")
955 (version "1.3")
956 (source
957 (origin
958 (method url-fetch)
959 (uri (string-append "https://github.com/myint/perceptualdiff/archive/v"
960 version ".tar.gz"))
961 (file-name (string-append name "-" version ".tar.gz"))
962 (sha256
963 (base32
964 "0zl6xmp971fffg7fzcz2fbgxg5x2w7l8qa65c008i4kbkc9016ps"))))
965 (build-system cmake-build-system)
966 (inputs `(("freeimage" ,freeimage)))
967 (arguments
968 '(#:phases (modify-phases %standard-phases
969 (add-after 'unpack 'fix-tests
970 ;; cmake-build-system uses a build/ directory outside
971 ;; of the source tree, one level higher than expected
972 (lambda _
973 (substitute* "test/run_tests.bash"
974 (("../build") "../../build")))))))
975 (home-page "https://github.com/myint/perceptualdiff")
976 (synopsis "Perceptual image comparison utility")
977 (description "PerceptualDiff visually compares two images to determine
978 whether they look alike. It uses a computational model of the human visual
979 system to detect similarities. This allows it too see beyond irrelevant
980 differences in file encoding, image quality, and other small variations.")
981 (license license:gpl2+)))
982
983 (define-public steghide
984 (package
985 (name "steghide")
986 (version "0.5.1")
987 (source (origin
988 (method url-fetch)
989 (uri (string-append "mirror://sourceforge/steghide/steghide/"
990 version "/steghide-" version ".tar.bz2"))
991 (sha256
992 (base32
993 "18bxlhbdc3zsmxj84i417xjh0q28kv26q449k23n0a72ldwziix2"))
994 (patches (list (search-patch "steghide-fixes.patch")))))
995 (build-system gnu-build-system)
996 (native-inputs
997 `(("gettext" ,gettext-minimal)
998 ("libtool" ,libtool)
999 ("perl" ,perl))) ;for tests
1000 (inputs
1001 `(("libmhash" ,libmhash)
1002 ("libmcrypt" ,libmcrypt)
1003 ("libjpeg" ,libjpeg)
1004 ("zlib" ,zlib)))
1005 (arguments
1006 `(#:make-flags '("CXXFLAGS=-fpermissive"))) ;required for MHashPP.cc
1007 (home-page "http://steghide.sourceforge.net")
1008 (synopsis "Image and audio steganography")
1009 (description
1010 "Steghide is a steganography program that is able to hide data in various
1011 kinds of image- and audio-files. The color- respectivly sample-frequencies
1012 are not changed thus making the embedding resistant against first-order
1013 statistical tests.")
1014 (license license:gpl2+)))
1015
1016 (define-public stb-image-for-extempore
1017 (let ((revision "1")
1018 (commit "152a250a702bf28951bb0220d63bc0c99830c498"))
1019 (package
1020 (name "stb-image-for-extempore")
1021 (version (string-append "0-" revision "." (string-take commit 9)))
1022 (source
1023 (origin (method git-fetch)
1024 (uri (git-reference
1025 (url "https://github.com/extemporelang/stb.git")
1026 (commit commit)))
1027 (sha256
1028 (base32
1029 "0y0aa20pj9311x2ii06zg8xs34idg14hfgldqc5ymizc6cf1qiqv"))
1030 (file-name (string-append name "-" version "-checkout"))))
1031 (build-system cmake-build-system)
1032 (arguments `(#:tests? #f)) ; no tests included
1033 ;; Extempore refuses to build on architectures other than x86_64
1034 (supported-systems '("x86_64-linux"))
1035 (home-page "https://github.com/extemporelang/stb")
1036 (synopsis "Image library for Extempore")
1037 (description
1038 "This package is a collection of assorted single-file libraries. Of
1039 all included libraries only the image loading and decoding library is
1040 installed as @code{stb_image}.")
1041 (license license:public-domain))))
1042
1043 (define-public optipng
1044 (package
1045 (name "optipng")
1046 (version "0.7.6")
1047 (source
1048 (origin
1049 (method url-fetch)
1050 (uri (string-append "http://prdownloads.sourceforge.net/optipng/optipng-"
1051 version ".tar.gz"))
1052 (sha256
1053 (base32
1054 "105yk5qykvhiahzag67gm36s2kplxf6qn5hay02md0nkrcgn6w28"))))
1055 (build-system gnu-build-system)
1056 (inputs
1057 `(("zlib" ,zlib)))
1058 (arguments
1059 '(#:phases
1060 (modify-phases %standard-phases
1061 ;; configure script does not accept arguments CONFIG_SHELL and SHELL
1062 (replace 'configure
1063 (lambda* (#:key outputs #:allow-other-keys)
1064 (zero? (system* "sh" "configure"
1065 (string-append "--prefix=" (assoc-ref outputs "out")))))))))
1066 (synopsis "Optimizer that recompresses PNG image files to a
1067 smaller size")
1068 (description "OptiPNG is a PNG optimizer that recompresses image
1069 files to a smaller size, without losing any information. This program
1070 also converts external formats (BMP, GIF, PNM and TIFF) to optimized
1071 PNG, and performs PNG integrity checks and corrections.")
1072 (home-page "http://optipng.sourceforge.net/")
1073 (license license:zlib)))
1074
1075 (define-public libjpeg-turbo
1076 (package
1077 (name "libjpeg-turbo")
1078 (version "1.5.1")
1079 (source (origin
1080 (method url-fetch)
1081 (uri (string-append "mirror://sourceforge/" name "/" version "/"
1082 name "-" version ".tar.gz"))
1083 (sha256
1084 (base32
1085 "0v365hm6z6lddcqagjj15wflk66rqyw75m73cqzl65rh4lyrshj1"))))
1086 (build-system gnu-build-system)
1087 (native-inputs
1088 `(("nasm" ,nasm)))
1089 (arguments
1090 '(#:test-target "test"
1091 #:phases
1092 (modify-phases %standard-phases
1093 (add-after 'unpack 'set-env-on-MIPS
1094 ;; This is borrowed from Debian's patchset for libjpeg
1095 ;; https://sources.debian.net/data/main/libj/libjpeg-turbo/1:1.5.1-2/debian/patches/0001-Declare-env-on-MIPS-on-first-use-Courtesy-of-Aurelie.patch
1096 (lambda _
1097 (substitute* "simd/jsimd_mips.c"
1098 (("env = getenv\\(\"JSIMD_FORCEDSPR2")
1099 "char *env = getenv(\"JSIMD_FORCEDSPR2"))
1100 #t)))))
1101 (home-page "http://www.libjpeg-turbo.org/")
1102 (synopsis "SIMD-accelerated JPEG image handling library")
1103 (description "libjpeg-turbo is a JPEG image codec that accelerates baseline
1104 JPEG compression and decompression using SIMD instructions: MMX on x86, SSE2 on
1105 x86-64, NEON on ARM, and AltiVec on PowerPC processors. Even on other systems,
1106 its highly-optimized Huffman coding routines allow it to outperform libjpeg by
1107 a significant amount.
1108 libjpeg-turbo implements both the traditional libjpeg API and the less powerful
1109 but more straightforward TurboJPEG API, and provides a full-featured Java
1110 interface. It supports color space extensions that allow it to compress from
1111 and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).")
1112 (license (list license:bsd-3 ; jsimd*.[ch] and most of simd/
1113 license:ijg)))) ; the rest
1114
1115 (define-public niftilib
1116 (package
1117 (name "niftilib")
1118 (version "2.0.0")
1119 (source (origin
1120 (method url-fetch)
1121 (uri (list (string-append "mirror://sourceforge/niftilib/"
1122 "nifticlib/nifticlib_"
1123 (string-join (string-split version #\.) "_")
1124 "/nifticlib-" version ".tar.gz")))
1125 (sha256
1126 (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
1127 (build-system gnu-build-system)
1128 (arguments
1129 '(#:tests? #f ; there is no test target
1130 #:parallel-build? #f ; not supported
1131 #:make-flags
1132 (list "SHELL=bash"
1133 (string-append "ZLIB_INC="
1134 (assoc-ref %build-inputs "zlib") "/include")
1135 ;; Append "-fPIC" to CFLAGS.
1136 (string-append "CFLAGS="
1137 "-Wall -ansi -pedantic -fPIC"))
1138 #:phases
1139 (modify-phases %standard-phases
1140 (replace 'install
1141 (lambda* (#:key outputs #:allow-other-keys)
1142 (let ((out (assoc-ref outputs "out")))
1143 (for-each
1144 (lambda (dir)
1145 (copy-recursively dir (string-append out "/" dir)))
1146 '("bin" "lib" "include")))
1147 #t))
1148 (delete 'configure))))
1149 (inputs
1150 `(("zlib" ,zlib)))
1151 (synopsis "Library for reading and writing files in the nifti-1 format")
1152 (description "Niftilib is a set of i/o libraries for reading and writing
1153 files in the nifti-1 data format - a binary file format for storing
1154 medical image data, e.g. magnetic resonance image (MRI) and functional MRI
1155 (fMRI) brain images.")
1156 (home-page "http://niftilib.sourceforge.net")
1157 (license license:public-domain)))