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