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