Merge remote-tracking branch 'origin/master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / image.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
5 ;;; Copyright © 2014, 2016 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
7 ;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
8 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
9 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
10 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages image)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages fontutils)
36 #:use-module (gnu packages ghostscript)
37 #:use-module (gnu packages gl)
38 #:use-module (gnu packages graphics)
39 #:use-module (gnu packages maths)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages xml)
44 #:use-module (gnu packages xorg)
45 #:use-module (gnu packages zip)
46 #:use-module ((guix licenses) #:prefix license:)
47 #:use-module (guix packages)
48 #:use-module (guix download)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system cmake)
51 #:use-module (srfi srfi-1))
52
53 (define-public libpng
54 (package
55 (name "libpng")
56 (version "1.5.26")
57 (source (origin
58 (method url-fetch)
59
60 ;; Note: upstream removes older tarballs.
61 (uri (list (string-append "mirror://sourceforge/libpng/libpng15/"
62 version "/libpng-" version ".tar.xz")
63 (string-append
64 "ftp://ftp.simplesystems.org/pub/libpng/png/src"
65 "/libpng15/libpng-" version ".tar.xz")))
66 (sha256
67 (base32 "0kbissyd7d4ahwdpm968nnzl7q15p6hadg44i9x0vrkrzdgdi93v"))))
68 (build-system gnu-build-system)
69
70 ;; libpng.la says "-lz", so propagate it.
71 (propagated-inputs `(("zlib" ,zlib)))
72
73 (synopsis "Library for handling PNG files")
74 (description
75 "Libpng is the official PNG (Portable Network Graphics) reference
76 library. It supports almost all PNG features and is extensible.")
77 (license license:zlib)
78 (home-page "http://www.libpng.org/pub/png/libpng.html")))
79
80 (define-public libpng-1.2
81 (package
82 (inherit libpng)
83 (version "1.2.56")
84 (source
85 (origin
86 (method url-fetch)
87 ;; Note: upstream removes older tarballs.
88 (uri (list (string-append "mirror://sourceforge/libpng/libpng12/"
89 version "/libpng-" version ".tar.xz")
90 (string-append
91 "ftp://ftp.simplesystems.org/pub/libpng/png/src"
92 "/libpng12/libpng-" version ".tar.xz")))
93 (sha256
94 (base32 "1ghd03p353x0vi4dk83n1nlldg11w7vqdk3f99rkgfb82ic59ki4"))))))
95
96 (define-public libjpeg
97 (package
98 (name "libjpeg")
99 (version "9a")
100 (source (origin
101 (method url-fetch)
102 (uri (string-append "http://www.ijg.org/files/jpegsrc.v"
103 version ".tar.gz"))
104 (sha256 (base32
105 "19q5zr4n60sjcvfbyv06n4pcl1mai3ipvnd2akflayciinj3wx9s"))))
106 (build-system gnu-build-system)
107 (synopsis "Library for handling JPEG files")
108 (description
109 "Libjpeg implements JPEG image encoding, decoding, and transcoding.
110 JPEG is a standardized compression method for full-color and gray-scale
111 images.
112 The included programs provide conversion between the JPEG format and
113 image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.")
114 (license license:ijg)
115 (home-page "http://www.ijg.org/")))
116
117 (define-public libjpeg-8
118 (package (inherit libjpeg)
119 (version "8d")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append "http://www.ijg.org/files/jpegsrc.v"
123 version ".tar.gz"))
124 (sha256 (base32
125 "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"))))))
126
127 (define-public jpegoptim
128 (package
129 (name "jpegoptim")
130 (version "1.4.3")
131 (source (origin
132 (method url-fetch)
133 (uri (string-append "http://www.kokkonen.net/tjko/src/jpegoptim-"
134 version ".tar.gz"))
135 (sha256 (base32
136 "0k53q7dc8w5ashz8v261x2b5vvz7gdvg8w962rz9gjvkjbh4lg93"))))
137 (build-system gnu-build-system)
138 (inputs `(("libjpeg" ,libjpeg)))
139 (arguments
140 ;; no tests
141 '(#:tests? #f))
142 (synopsis "Optimize JPEG images")
143 (description
144 "jpegoptim provides lossless optimization (based on optimizing
145 the Huffman tables) and \"lossy\" optimization based on setting
146 maximum quality factor.")
147 (license license:gpl2+)
148 (home-page "http://www.kokkonen.net/tjko/projects.html#jpegoptim")))
149
150 (define-public libtiff
151 (package
152 (name "libtiff")
153 (version "4.0.6")
154 (source (origin
155 (method url-fetch)
156 (uri (string-append "ftp://ftp.remotesensing.org/pub/libtiff/tiff-"
157 version ".tar.gz"))
158 (sha256 (base32
159 "136nf1rj9dp5jgv1p7z4dk0xy3wki1w0vfjbk82f645m0w4samsd"))
160 (patches (search-patches
161 "libtiff-oob-accesses-in-decode.patch"
162 "libtiff-oob-write-in-nextdecode.patch"
163 "libtiff-CVE-2015-8665+CVE-2015-8683.patch"))))
164 (build-system gnu-build-system)
165 (outputs '("out"
166 "doc")) ;1.3 MiB of HTML documentation
167 (arguments
168 ;; Instead of using --docdir, this package has its own --with-docdir.
169 `(#:configure-flags (list (string-append "--with-docdir="
170 (assoc-ref %outputs "doc")
171 "/share/doc/"
172 ,name "-" ,version))))
173 (inputs `(("zlib" ,zlib)
174 ("libjpeg" ,libjpeg)))
175 (synopsis "Library for handling TIFF files")
176 (description
177 "Libtiff provides support for the Tag Image File Format (TIFF), a format
178 used for storing image data.
179 Included are a library, libtiff, for reading and writing TIFF and a small
180 collection of tools for doing simple manipulations of TIFF images.")
181 (license (license:non-copyleft "file://COPYRIGHT"
182 "See COPYRIGHT in the distribution."))
183 (home-page "http://www.remotesensing.org/libtiff/")))
184
185 (define-public libwmf
186 (package
187 (name "libwmf")
188 (version "0.2.8.4")
189 (source
190 (origin
191 (method url-fetch)
192 (uri (string-append "mirror://sourceforge/wvware/"
193 name "/" version
194 "/" name "-" version ".tar.gz"))
195 (sha256
196 (base32 "1y3wba4q8pl7kr51212jwrsz1x6nslsx1gsjml1x0i8549lmqd2v"))
197 (patches
198 (search-patches "libwmf-CAN-2004-0941.patch"
199 "libwmf-CVE-2006-3376.patch"
200 "libwmf-CVE-2007-0455.patch"
201 "libwmf-CVE-2007-2756.patch"
202 "libwmf-CVE-2007-3472.patch"
203 "libwmf-CVE-2007-3473.patch"
204 "libwmf-CVE-2007-3477.patch"
205 "libwmf-CVE-2009-1364.patch"
206 "libwmf-CVE-2009-3546.patch"
207 "libwmf-CVE-2015-0848+CVE-2015-4588.patch"
208 "libwmf-CVE-2015-4695.patch"
209 "libwmf-CVE-2015-4696.patch"))))
210
211 (build-system gnu-build-system)
212 (inputs
213 `(("freetype" ,freetype)
214 ("libjpeg" ,libjpeg)
215 ("libpng",libpng)
216 ("libxml2" ,libxml2)
217 ("zlib" ,zlib)))
218 (native-inputs
219 `(("pkg-config" ,pkg-config)))
220 (synopsis "Library for reading images in the Microsoft WMF format")
221 (description
222 "libwmf is a library for reading vector images in Microsoft's native
223 Windows Metafile Format (WMF) and for either (a) displaying them in, e.g., an X
224 window; or (b) converting them to more standard/free file formats such as, e.g.,
225 the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
226 (home-page "http://wvware.sourceforge.net/libwmf.html")
227
228 ;; 'COPYING' is the GPLv2, but file headers say LGPLv2.0+.
229 (license license:lgpl2.0+)))
230
231 (define-public leptonica
232 (package
233 (name "leptonica")
234 (version "1.72")
235 (source
236 (origin
237 (method url-fetch)
238 (uri (string-append "http://www.leptonica.com/source/leptonica-"
239 version ".tar.gz"))
240 (sha256
241 (base32 "0mhzvqs0im04y1cpcc1yma70hgdac1frf33h73m9z3356bfymmbr"))
242 (modules '((guix build utils)))
243 ;; zlib and openjpg should be under Libs, not Libs.private. See:
244 ;; https://code.google.com/p/tesseract-ocr/issues/detail?id=1436
245 (snippet
246 '(substitute* "lept.pc.in"
247 (("^(Libs\\.private: .*)@ZLIB_LIBS@(.*)" all pre post)
248 (string-append pre post))
249 (("^(Libs\\.private: .*)@JPEG_LIBS@(.*)" all pre post)
250 (string-append pre post))
251 (("^Libs: .*" all)
252 (string-append all " @ZLIB_LIBS@ @JPEG_LIBS@"))))))
253 (build-system gnu-build-system)
254 (native-inputs
255 `(("gnuplot" ,gnuplot))) ;needed for test suite
256 (inputs
257 `(("giflib" ,giflib)
258 ("libjpeg" ,libjpeg)
259 ("libpng" ,libpng)
260 ("libtiff" ,libtiff)
261 ("libwebp" ,libwebp)))
262 (propagated-inputs
263 `(("openjpeg" ,openjpeg)
264 ("zlib" ,zlib)))
265 (arguments
266 '(#:parallel-tests? #f ; XXX: cause fpix1_reg to fail
267 #:phases
268 (modify-phases %standard-phases
269 ;; Prevent make from trying to regenerate config.h.in.
270 (add-after
271 'unpack 'set-config-h-in-file-time
272 (lambda _
273 (set-file-time "config/config.h.in" (stat "configure"))))
274 (add-after
275 'unpack 'patch-reg-wrapper
276 (lambda _
277 (substitute* "prog/reg_wrapper.sh"
278 ((" /bin/sh ")
279 (string-append " " (which "sh") " "))
280 (("which gnuplot") (which "gnuplot")))))
281 (add-before
282 'check 'disable-failing-tests
283 ;; XXX: 2 of 9 tests from webpio_reg fails.
284 (lambda _
285 (substitute* "prog/webpio_reg.c"
286 ((".*DoWebpTest2.* 90.*") "")
287 ((".*DoWebpTest2.* 100.*") "")))))))
288 (home-page "http://www.leptonica.com/")
289 (synopsis "Library and tools for image processing and analysis")
290 (description
291 "Leptonica is a C library and set of command-line tools for efficient
292 image processing and image analysis operations. It supports rasterop, affine
293 transformations, binary and grayscale morphology, rank order, and convolution,
294 seedfill and connected components, image transformations combining changes in
295 scale and pixel depth, and pixelwise masking, blending, enhancement, and
296 arithmetic ops.")
297 (license license:bsd-2)))
298
299 (define-public jbig2dec
300 (package
301 (name "jbig2dec")
302 (version "0.11")
303 (source
304 (origin
305 (method url-fetch)
306 (uri ;; The link on the homepage is dead.
307 (string-append "http://distfiles.gentoo.org/distfiles/" name "-"
308 version ".tar.gz"))
309 (sha256
310 (base32 "1ffhgmf2fqzk0h4k736pp06z7q5y4x41fg844bd6a9vgncq86bby"))
311 (patches (search-patches "jbig2dec-ignore-testtest.patch"))))
312
313 (build-system gnu-build-system)
314 (synopsis "Decoder of the JBIG2 image compression format")
315 (description
316 "JBIG2 is designed for lossy or lossless encoding of 'bilevel' (1-bit
317 monochrome) images at moderately high resolution, and in particular scanned
318 paper documents. In this domain it is very efficient, offering compression
319 ratios on the order of 100:1.
320
321 This is a decoder only implementation, and currently is in the alpha
322 stage, meaning it doesn't completely work yet. However, it is
323 maintaining parity with available encoders, so it is useful for real
324 work.")
325 (home-page "http://jbig2dec.sourceforge.net/")
326 (license license:gpl2+)))
327
328 (define-public openjpeg
329 (package
330 (name "openjpeg")
331 (version "2.1.0")
332 (source
333 (origin
334 (method url-fetch)
335 (uri
336 (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
337 name "-" version ".tar.gz"))
338 (sha256
339 (base32 "00zzm303zvv4ijzancrsb1cqbph3pgz0nky92k9qx3fq9y0vnchj"))
340 (patches (search-patches "openjpeg-use-after-free-fix.patch"
341 "openjpeg-CVE-2015-6581.patch"))))
342 (build-system cmake-build-system)
343 (arguments
344 ;; Trying to run `$ make check' results in a no rule fault.
345 '(#:tests? #f))
346 (inputs
347 `(("lcms" ,lcms)
348 ("libpng" ,libpng)
349 ("libtiff" ,libtiff)
350 ("zlib" ,zlib)))
351 (synopsis "JPEG 2000 codec")
352 (description
353 "The OpenJPEG library is a JPEG 2000 codec written in C. It has
354 been developed in order to promote the use of JPEG 2000, the new
355 still-image compression standard from the Joint Photographic Experts
356 Group (JPEG).
357
358 In addition to the basic codec, various other features are under
359 development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats,
360 an indexing tool useful for the JPIP protocol, JPWL-tools for
361 error-resilience, a Java-viewer for j2k-images, ...")
362 (home-page "https://github.com/uclouvain/openjpeg")
363 (license license:bsd-2)))
364
365 (define-public openjpeg-2.0
366 (package (inherit openjpeg)
367 (name "openjpeg")
368 (version "2.0.1")
369 (source
370 (origin
371 (method url-fetch)
372 (uri
373 (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
374 name "-" version ".tar.gz"))
375 (sha256
376 (base32 "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z"))
377 (patches (search-patches "openjpeg-use-after-free-fix.patch"
378 "openjpeg-CVE-2015-6581.patch"))))))
379
380 (define-public openjpeg-1
381 (package (inherit openjpeg)
382 (name "openjpeg")
383 (version "1.5.2")
384 (source
385 (origin
386 (method url-fetch)
387 (uri
388 (string-append "mirror://sourceforge/openjpeg.mirror/" version "/"
389 name "-" version ".tar.gz"))
390 (sha256
391 (base32 "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm"))))))
392
393 (define-public giflib
394 (package
395 (name "giflib")
396 (version "5.1.4")
397 (source (origin
398 (method url-fetch)
399 (uri (string-append "mirror://sourceforge/giflib/giflib-"
400 version ".tar.bz2"))
401 (sha256
402 (base32
403 "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))))
404 (build-system gnu-build-system)
405 (outputs '("bin" ; utility programs
406 "out")) ; library
407 (inputs `(("libx11" ,libx11)
408 ("libice" ,libice)
409 ("libsm" ,libsm)
410 ("perl" ,perl)))
411 (arguments
412 `(#:phases
413 (modify-phases %standard-phases
414 (add-after 'unpack 'disable-html-doc-gen
415 (lambda _
416 (substitute* "doc/Makefile.in"
417 (("^all: allhtml manpages") ""))))
418 (add-after 'install 'install-manpages
419 (lambda* (#:key outputs #:allow-other-keys)
420 (let* ((bin (assoc-ref outputs "bin"))
421 (man1dir (string-append bin "/share/man/man1")))
422 (mkdir-p man1dir)
423 (for-each (lambda (file)
424 (let ((base (basename file)))
425 (format #t "installing `~a' to `~a'~%"
426 base man1dir)
427 (copy-file file
428 (string-append
429 man1dir "/" base))))
430 (find-files "doc" "\\.1"))))))))
431 (synopsis "Tools and library for working with GIF images")
432 (description
433 "GIFLIB is a library for reading and writing GIF images. It is API and
434 ABI compatible with libungif which was in wide use while the LZW compression
435 algorithm was patented. Tools are also included to convert, manipulate,
436 compose, and analyze GIF images.")
437 (home-page "http://giflib.sourceforge.net/")
438 (license license:x11)))
439
440 (define-public libungif
441 (package
442 (name "libungif")
443 (version "4.1.4")
444 (source (origin
445 (method url-fetch)
446 (uri (string-append "mirror://sourceforge/giflib/libungif-4.x/"
447 "libungif-" version "/libungif-"
448 version ".tar.bz2"))
449 (sha256
450 (base32
451 "0cnksimmmjngdrys302ik1385sg1sj4i0gxivzldhgwd46n7x2kh"))))
452 (build-system gnu-build-system)
453 (inputs `(("perl" ,perl))) ;package ships some perl tools
454 (home-page "http://giflib.sourceforge.net/")
455 (synopsis "GIF decompression library")
456 (description
457 "libungif is the old GIF decompression library by the GIFLIB project.")
458 (license license:expat)))
459
460 (define-public imlib2
461 (package
462 (name "imlib2")
463 (version "1.4.9")
464 (source (origin
465 (method url-fetch)
466 (uri (string-append
467 "mirror://sourceforge/enlightenment/imlib2-src/" version
468 "/imlib2-" version ".tar.bz2"))
469 (sha256
470 (base32
471 "08809xxk2555yj6glixzw9a0x3x8cx55imd89kj3r0h152bn8a3x"))))
472 (build-system gnu-build-system)
473 (native-inputs
474 `(("pkgconfig" ,pkg-config)))
475 (inputs
476 `(("libx11" ,libx11)
477 ("libxext" ,libxext)
478 ("freetype" ,freetype)
479 ("libjpeg" ,libjpeg)
480 ("libpng" ,libpng)
481 ("libtiff" ,libtiff)
482 ("giflib" ,giflib)
483 ("bzip2" ,bzip2)))
484 (home-page "http://sourceforge.net/projects/enlightenment/")
485 (synopsis
486 "Loading, saving, rendering and manipulating image files")
487 (description
488 "Imlib2 is a library that does image file loading and saving as well as
489 rendering, manipulation, arbitrary polygon support, etc.
490
491 It does ALL of these operations FAST. Imlib2 also tries to be highly
492 intelligent about doing them, so writing naive programs can be done easily,
493 without sacrificing speed.
494
495 This is a complete rewrite over the Imlib 1.x series. The architecture is
496 more modular, simple, and flexible.")
497 (license license:imlib2)))
498
499 (define-public giblib
500 (package
501 (name "giblib")
502 (version "1.2.4")
503 (source (origin
504 (method url-fetch)
505 (uri (list
506 (string-append
507 "http://linuxbrit.co.uk/downloads/giblib-"
508 version ".tar.gz")
509 (string-append
510 "https://sourceforge.net/projects/slackbuildsdirectlinks/"
511 "files/giblib/giblib-" version ".tar.gz")))
512 (sha256
513 (base32
514 "1b4bmbmj52glq0s898lppkpzxlprq9aav49r06j2wx4dv3212rhp"))))
515 (build-system gnu-build-system)
516 (inputs
517 `(("libx11" ,libx11)
518 ("imlib2" ,imlib2)))
519 (home-page "http://linuxbrit.co.uk/software/") ; no real home-page
520 (synopsis "Wrapper library for imlib2")
521 (description
522 "Giblib is a simple library which wraps imlib2's context API, avoiding
523 all the context_get/set calls, adds fontstyles to the truetype renderer and
524 supplies a generic doubly-linked list and some string functions.")
525 ;; This license removes a clause about X Consortium from the original
526 ;; X11 license.
527 (license (license:x11-style "file://COPYING"
528 "See 'COPYING' in the distribution."))))
529
530 (define-public freeimage
531 (package
532 (name "freeimage")
533 (version "3.17.0")
534 (source (origin
535 (method url-fetch)
536 (uri (string-append
537 "mirror://sourceforge/freeimage/Source%20Distribution/"
538 version "/FreeImage"
539 (string-concatenate (string-split version #\.))
540 ".zip"))
541 (sha256
542 (base32
543 "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v"))
544 (patches (search-patches "freeimage-CVE-2015-0852.patch"))))
545 (build-system gnu-build-system)
546 (arguments
547 '(#:phases (alist-delete
548 'configure
549 (alist-cons-before
550 'build 'patch-makefile
551 (lambda* (#:key outputs #:allow-other-keys)
552 (substitute* "Makefile.gnu"
553 (("/usr") (assoc-ref outputs "out"))
554 (("-o root -g root") "")))
555 %standard-phases))
556 #:make-flags '("CC=gcc")
557 #:tests? #f)) ; no check target
558 (native-inputs
559 `(("unzip" ,unzip)))
560 ;; Fails to build on MIPS due to assembly code in the source.
561 (supported-systems (delete "mips64el-linux" %supported-systems))
562 (synopsis "Library for handling popular graphics image formats")
563 (description
564 "FreeImage is a library for developers who would like to support popular
565 graphics image formats like PNG, BMP, JPEG, TIFF and others.")
566 (license license:gpl2+)
567 (home-page "http://freeimage.sourceforge.net")))
568
569 (define-public vigra
570 (package
571 (name "vigra")
572 (version "1.11.0")
573 (source
574 (origin
575 (method url-fetch)
576 (uri (string-append "https://github.com/ukoethe/vigra/releases/download/"
577 "Version-1-11-0/vigra-"
578 version "-src.tar.gz"))
579 (sha256 (base32
580 "1jzm79kqiiilvys3b8mlzy9cvmiirrcwsrlg19qd9rza8zipsqb8"))))
581 (build-system cmake-build-system)
582 (inputs
583 `(("boost" ,boost)
584 ("fftw" ,fftw)
585 ("fftwf" ,fftwf)
586 ("hdf5" ,hdf5)
587 ("ilmbase" ,ilmbase) ; propagated by openexr, but needed explicitly
588 ; to create a configure-flag
589 ("libjpeg" ,libjpeg)
590 ("libpng" ,libpng)
591 ("libtiff" ,libtiff)
592 ("openexr" ,openexr)
593 ("python" ,python-2) ; print syntax
594 ("python2-numpy" ,python2-numpy)
595 ("zlib" ,zlib)))
596 (native-inputs
597 `(("doxygen" ,doxygen)
598 ("python2-nose" ,python2-nose)
599 ("python2-sphinx" ,python2-sphinx)))
600 (arguments
601 `(#:test-target "check"
602 #:parallel-build? #f ; parallel builds trigger an ICE
603 #:configure-flags
604 (list "-Wno-dev" ; suppress developer mode with lots of warnings
605 (string-append "-DVIGRANUMPY_INSTALL_DIR="
606 (assoc-ref %outputs "out")
607 "/lib/python2.7/site-packages")
608 ;; OpenEXR is not enabled by default.
609 "-DWITH_OPENEXR=1"
610 ;; The header files of ilmbase are not found when included
611 ;; by the header files of openexr, and an explicit flag
612 ;; needs to be set.
613 (string-append "-DCMAKE_CXX_FLAGS=-I"
614 (assoc-ref %build-inputs "ilmbase")
615 "/include/OpenEXR"))))
616 (synopsis "Computer vision library")
617 (description
618 "VIGRA stands for Vision with Generic Algorithms. It is an image
619 processing and analysis library that puts its main emphasis on customizable
620 algorithms and data structures. It is particularly strong for
621 multi-dimensional image processing.")
622 (license license:expat)
623 (home-page "https://hci.iwr.uni-heidelberg.de/vigra")))
624
625 (define-public libwebp
626 (package
627 (name "libwebp")
628 (version "0.4.3")
629 (source
630 (origin
631 (method url-fetch)
632 (uri (string-append
633 "http://downloads.webmproject.org/releases/webp/libwebp-" version
634 ".tar.gz"))
635 (sha256
636 (base32 "1i4hfczjm3b1qj1g4cc9hgb69l47f3nkgf6hk7nz4dm9zmc0vgpg"))))
637 (build-system gnu-build-system)
638 (inputs
639 `(("freeglut" ,freeglut)
640 ("giflib" ,giflib)
641 ("libjpeg" ,libjpeg)
642 ("libpng" ,libpng)
643 ("libtiff" ,libtiff)))
644 (arguments
645 '(#:configure-flags '("--enable-libwebpmux"
646 "--enable-libwebpdemux"
647 "--enable-libwebpdecoder")))
648 (home-page "https://developers.google.com/speed/webp/")
649 (synopsis "Lossless and lossy image compression")
650 (description
651 "WebP is a new image format that provides lossless and lossy compression
652 for images. WebP lossless images are 26% smaller in size compared to
653 PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at
654 equivalent SSIM index. WebP supports lossless transparency (also known as
655 alpha channel) with just 22% additional bytes. Transparency is also supported
656 with lossy compression and typically provides 3x smaller file sizes compared
657 to PNG when lossy compression is acceptable for the red/green/blue color
658 channels.")
659 (license license:bsd-3)))
660
661 (define-public libmng
662 (package
663 (name "libmng")
664 (version "2.0.3")
665 (source (origin
666 (method url-fetch)
667 (uri (string-append "mirror://sourceforge/libmng/libmng-devel/"
668 version "/" name "-" version ".tar.xz"))
669 (sha256
670 (base32
671 "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija"))))
672 (build-system gnu-build-system)
673 (propagated-inputs
674 ;; These are all in the 'Libs.private' field of libmng.pc.
675 `(("lcms" ,lcms)
676 ("libjpeg" ,libjpeg)
677 ("zlib" ,zlib)))
678 (home-page "http://www.libmng.com/")
679 (synopsis "Library for handling MNG files")
680 (description
681 "Libmng is the MNG (Multiple-image Network Graphics) reference library.")
682 (license license:bsd-3)))
683
684 (define-public devil
685 (package
686 (name "devil")
687 (version "1.7.8")
688 (source (origin
689 (method url-fetch)
690 (uri (string-append "http://downloads.sourceforge.net/openil/"
691 "DevIL-" version ".tar.gz"))
692 (sha256
693 (base32
694 "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8"))
695 ;; Backported from upstream:
696 ;; https://github.com/DentonW/DevIL/commit/724194d7a9a91221a564579f64bdd6f0abd64219.patch
697 (patches (search-patches "devil-fix-libpng.patch"
698 "devil-CVE-2009-3994.patch"))
699 (modules '((guix build utils)))
700 (snippet
701 ;; Fix old lcms include directives and lib flags.
702 '(substitute* '("configure" "src-IL/src/il_profiles.c")
703 (("-llcms") "-llcms2")
704 (("lcms/lcms\\.h") "lcms2/lcms2.h")
705 (("lcms\\.h") "lcms2.h")))))
706 (build-system gnu-build-system)
707 (arguments
708 '(#:configure-flags '("--enable-ILUT=yes") ; build utility library
709 #:phases
710 (modify-phases %standard-phases
711 (add-before 'check 'fix-tests
712 (lambda* (#:key inputs #:allow-other-keys)
713 ;; Fix hard-coded /bin/bash reference.
714 (substitute* '("test/Makefile")
715 (("TESTS_ENVIRONMENT = /bin/bash")
716 (string-append "TESTS_ENVIRONMENT = "
717 (assoc-ref inputs "bash")
718 "/bin/bash")))
719 #t)))))
720 (native-inputs
721 `(("pkg-config" ,pkg-config)))
722 (inputs
723 `(("lcms" ,lcms)
724 ("libjpeg" ,libjpeg)
725 ("libmng" ,libmng)
726 ("libpng" ,libpng)
727 ("libtiff" ,libtiff)
728 ("openexr" ,openexr)
729 ("zlib" ,zlib)))
730 (synopsis "Library for manipulating many image formats")
731 (description "Developer's Image Library (DevIL) is a library to develop
732 applications with support for many types of images. DevIL can load, save,
733 convert, manipulate, filter and display a wide variety of image formats.")
734 (home-page "http://openil.sourceforge.net")
735 (license license:lgpl2.1+)))
736
737 (define-public jasper
738 (package
739 (name "jasper")
740 (version "1.900.1")
741 (source (origin
742 (method url-fetch)
743 (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
744 "/software/jasper-" version ".zip"))
745 (sha256
746 (base32
747 "154l7zk7yh3v8l2l6zm5s2alvd2fzkp6c9i18iajfbna5af5m43b"))
748 (patches (search-patches
749 "jasper-CVE-2007-2721.patch"
750 "jasper-CVE-2008-3520.patch"
751 "jasper-CVE-2008-3522.patch"
752 "jasper-CVE-2011-4516-and-CVE-2011-4517.patch"
753 "jasper-CVE-2014-8137.patch"
754 "jasper-CVE-2014-8138.patch"
755 "jasper-CVE-2014-8157.patch"
756 "jasper-CVE-2014-8158.patch"
757 "jasper-CVE-2014-9029.patch"
758 "jasper-CVE-2016-1577.patch"
759 "jasper-CVE-2016-1867.patch"
760 "jasper-CVE-2016-2089.patch"
761 "jasper-CVE-2016-2116.patch"))))
762 (build-system gnu-build-system)
763 (native-inputs
764 `(("unzip" ,unzip)))
765 (synopsis "JPEG-2000 library")
766 (description "The JasPer Project is an initiative to provide a reference
767 implementation of the codec specified in the JPEG-2000 Part-1 standard (i.e.,
768 ISO/IEC 15444-1).")
769 (home-page "https://www.ece.uvic.ca/~frodo/jasper/")
770 (license (license:x11-style "file://LICENSE"))))
771
772 (define-public zimg
773 (package
774 (name "zimg")
775 (version "2.1")
776 (source
777 (origin
778 (method url-fetch)
779 (uri (string-append "https://github.com/sekrit-twc/zimg/archive/"
780 "release-" version ".tar.gz"))
781 (file-name (string-append name "-" version ".tar.gz"))
782 (sha256
783 (base32
784 "1hqp1gcsa2zhypms5dnasb1srjgxdqm7cip3w5i571kk9nxkn289"))))
785 (build-system gnu-build-system)
786 (native-inputs
787 `(("autoconf" ,autoconf)
788 ("automake" ,automake)
789 ("libtool" ,libtool)))
790 (arguments
791 '(#:phases
792 (modify-phases %standard-phases
793 (add-after 'unpack 'autogen
794 (lambda _
795 (zero? (system* "sh" "autogen.sh")))))))
796 (synopsis "Scaling, colorspace conversion, and dithering library")
797 (description "Zimg implements the commonly required image processing basics
798 of scaling, colorspace conversion, and depth conversion. A simple API enables
799 conversion between any supported formats to operate with minimal knowledge from
800 the programmer.")
801 (home-page "https://github.com/sekrit-twc/zimg")
802 ;; test/extra/ contains musl-libm,
803 ;; which is MIT/expat licensed, but only used for tests
804 (license (license:fsf-free "file://COPYING")))) ;WTFPL version 2
805
806 (define-public perceptualdiff
807 (package
808 (name "perceptualdiff")
809 (version "1.3")
810 (source
811 (origin
812 (method url-fetch)
813 (uri (string-append "https://github.com/myint/perceptualdiff/archive/v"
814 version ".tar.gz"))
815 (file-name (string-append name "-" version ".tar.gz"))
816 (sha256
817 (base32
818 "0zl6xmp971fffg7fzcz2fbgxg5x2w7l8qa65c008i4kbkc9016ps"))))
819 (build-system cmake-build-system)
820 (inputs `(("freeimage" ,freeimage)))
821 (arguments
822 '(#:phases (modify-phases %standard-phases
823 (add-after 'unpack 'fix-tests
824 ;; cmake-build-system uses a build/ directory outside
825 ;; of the source tree, one level higher than expected
826 (lambda _
827 (substitute* "test/run_tests.bash"
828 (("../build") "../../build")))))))
829 (home-page "https://github.com/myint/perceptualdiff")
830 (synopsis "Perceptual image comparison utility")
831 (description "PerceptualDiff visually compares two images to determine
832 whether they look alike. It uses a computational model of the human visual
833 system to detect similarities. This allows it too see beyond irrelevant
834 differences in file encoding, image quality, and other small variations.")
835 (license license:gpl2+)))