gnu: Add chafa.
[guix.git] / gnu / packages / image-viewers.scm
blob7d2ff9a67788ea1bac39c87363fd71d15416bf8e
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
4 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
5 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Alex Griffin <a@ajgrf.com>
7 ;;; Copyright © 2017 ng0 <ng0@n0.is>
8 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
9 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
10 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
13 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages image-viewers)
31   #:use-module ((guix licenses) #:prefix license:)
32   #:use-module (guix download)
33   #:use-module (guix git-download)
34   #:use-module (guix packages)
35   #:use-module (guix build-system gnu)
36   #:use-module (guix build-system cmake)
37   #:use-module (guix build-system meson)
38   #:use-module (guix build-system python)
39   #:use-module (gnu packages autotools)
40   #:use-module (gnu packages algebra)
41   #:use-module (gnu packages boost)
42   #:use-module (gnu packages compression)
43   #:use-module (gnu packages curl)
44   #:use-module (gnu packages fontutils)
45   #:use-module (gnu packages gettext)
46   #:use-module (gnu packages ghostscript)
47   #:use-module (gnu packages glib)
48   #:use-module (gnu packages gnome)
49   #:use-module (gnu packages gtk)
50   #:use-module (gnu packages graphics)
51   #:use-module (gnu packages image)
52   #:use-module (gnu packages imagemagick)
53   #:use-module (gnu packages maths)
54   #:use-module (gnu packages perl)
55   #:use-module (gnu packages perl-check)
56   #:use-module (gnu packages photo)
57   #:use-module (gnu packages pkg-config)
58   #:use-module (gnu packages python)
59   #:use-module (gnu packages python-xyz)
60   #:use-module (gnu packages qt)
61   #:use-module (gnu packages xorg)
62   #:use-module (gnu packages))
64 (define-public feh
65   (package
66     (name "feh")
67     (version "3.1.3")
68     (home-page "https://feh.finalrewind.org/")
69     (source (origin
70               (method url-fetch)
71               (uri (string-append home-page
72                                   name "-" version ".tar.bz2"))
73               (sha256
74                (base32
75                 "1vsnxf4as3vyzjfhd8frzb1a8i7wnq7ck5ljx7qxqrnfqvxl1s4z"))))
76     (build-system gnu-build-system)
77     (arguments
78      '(#:phases (modify-phases %standard-phases (delete 'configure))
79        #:test-target "test"
80        #:make-flags
81        (list "CC=gcc" (string-append "PREFIX=" (assoc-ref %outputs "out"))
82              "exif=1")))
83     (native-inputs
84      `(("perl" ,perl)
85        ("perl-test-command" ,perl-test-command)))
86     (inputs `(("imlib2" ,imlib2)
87               ("curl" ,curl)
88               ("libexif" ,libexif)
89               ("libpng" ,libpng)
90               ("libxt" ,libxt)
91               ("libx11" ,libx11)
92               ("libxinerama" ,libxinerama)))
93     (native-search-paths
94      ;; Feh allows overriding the libcurl builtin CA path (unset in Guix)
95      ;; with the same variable as the `curl` command line HTTP tool.
96      (package-native-search-paths curl))
97     (synopsis "Fast and light imlib2-based image viewer")
98     (description
99       "feh is an X11 image viewer aimed mostly at console users.
100 Unlike most other viewers, it does not have a fancy GUI, but simply
101 displays images.  It can also be used to set the desktop wallpaper.
102 It is controlled via commandline arguments and configurable key/mouse
103 actions.")
105     ;; The license is really the Expat license, with additional wording in the
106     ;; 2nd paragraph: "acknowledgment shall be given in the documentation and
107     ;; software packages that this Software was used."
108     (license (license:x11-style
109               "file://COPYING"
110               "See 'COPYING' in the distribution."))))
112 (define-public geeqie
113   (package
114     (name "geeqie")
115     (version "1.4")
116     (source (origin
117              (method url-fetch)
118              (uri (string-append "https://github.com/BestImageViewer/geeqie/"
119                                  "releases/download/v" version "/geeqie-"
120                                  version ".tar.xz"))
121              (sha256
122               (base32
123                "0ciygvcxb78pqg59r6p061mkbpvkgv2rv3r79j3kgv3kalb3ln2w"))))
124     (build-system gnu-build-system)
125     (arguments
126      `(;; Enable support for a "map" pane using GPS data.
127        #:configure-flags '("--enable-map")
129        #:phases
130        (modify-phases %standard-phases
131          (add-before 'bootstrap 'pre-bootstrap
132            (lambda _
133              (define (write-dummy-changelog port)
134                (display "See Git history for a change log.\n" port))
135              ;; Create ChangeLog{,.html} to placate the makefile, which would
136              ;; otherwise require access to the Git repo.
137              (call-with-output-file "ChangeLog"
138                write-dummy-changelog)
139              (call-with-output-file "ChangeLog.html"
140                write-dummy-changelog)
141              (setenv "NOCONFIGURE" "true")
142              #t)))))
143     (inputs
144      `(("clutter" ,clutter)
145        ("libchamplain" ,libchamplain)
146        ("lcms" ,lcms)
147        ("exiv2" ,exiv2)
148        ("libpng" ,libpng)
149        ("gtk+" ,gtk+)))
150     (native-inputs
151      `(("autoconf" ,autoconf)
152        ("automake" ,automake)
153        ("glib" ,glib "bin") ; glib-gettextize
154        ("intltool" ,intltool)
155        ("pkg-config" ,pkg-config)))
156     (home-page "http://www.geeqie.org/")
157     (synopsis "Lightweight GTK+ based image viewer")
158     (description
159      "Geeqie is a lightweight GTK+ based image viewer for Unix like operating
160 systems.  It features: EXIF, IPTC and XMP metadata browsing and editing
161 interoperability; easy integration with other software; geeqie works on files
162 and directories, there is no need to import images; fast preview for many raw
163 image formats; tools for image comparison, sorting and managing photo
164 collection.  Geeqie was initially based on GQview.")
165     (license license:gpl2+)))
167 (define-public gpicview
168   (package
169     (name "gpicview")
170     (version "0.2.5")
171     (source (origin
172               (method url-fetch)
173               (uri (string-append "mirror://sourceforge/lxde/"
174                                   "GPicView%20%28image%20Viewer%29/0.2.x/"
175                                   name "-" version ".tar.xz"))
176               (sha256
177                (base32
178                 "0hi9v0rdx47nys0wvm9xasdrafa34r5kq6crb074a0ipwmc60iiq"))))
179     (build-system gnu-build-system)
180     (inputs `(("gtk+" ,gtk+-2)
181               ("libjpeg" ,libjpeg)))
182     (native-inputs `(("intltool"   ,intltool)
183                      ("pkg-config" ,pkg-config)))
184     (synopsis "Simple and fast image viewer for X")
185     (description "gpicview is a lightweight GTK+ 2.x based image viewer.
186 It is the default image viewer on LXDE desktop environment.")
187     (home-page "http://lxde.sourceforge.net/gpicview/")
188     (license license:gpl2+)))
190 (define-public sxiv
191   (package
192     (name "sxiv")
193     (version "25")
194     (source (origin
195               (method git-fetch)
196               (uri (git-reference
197                     (url "https://github.com/muennich/sxiv.git")
198                     (commit (string-append "v" version))))
199               (file-name (git-file-name name version))
200               (sha256
201                (base32
202                 "13s1lfar142hq1j7xld0ri616p4bqs57b17yr4d0b9a9w7liz4hp"))))
203     (build-system gnu-build-system)
204     (arguments
205      `(#:tests? #f                      ; no check target
206        #:make-flags
207        (list (string-append "PREFIX=" %output)
208              "CC=gcc"
209              ;; Xft.h #includes <ft2build.h> (without ‘freetype2/’).  The sxiv
210              ;; Makefile works around this by hard-coding /usr/include instead.
211              (string-append "CPPFLAGS=-I"
212                             (assoc-ref %build-inputs "freetype")
213                             "/include/freetype2")
214              "V=1")
215        #:phases
216        (modify-phases %standard-phases
217          (delete 'configure))))         ; no configure script
218     (inputs
219      `(("freetype" ,freetype)
220        ("giflib" ,giflib)
221        ("imlib2" ,imlib2)
222        ("libexif" ,libexif)
223        ("libx11" ,libx11)
224        ("libxft" ,libxft)))
225     (home-page "https://github.com/muennich/sxiv")
226     (synopsis "Simple X Image Viewer")
227     (description
228      "sxiv is an alternative to feh and qiv.  Its primary goal is to
229 provide the most basic features required for fast image viewing.  It has
230 vi key bindings and works nicely with tiling window managers.  Its code
231 base should be kept small and clean to make it easy for you to dig into
232 it and customize it for your needs.")
233     (license license:gpl2+)))
235 (define-public viewnior
236   (package
237     (name "viewnior")
238     (version "1.7")
239     (source
240       (origin
241         (method git-fetch)
242         (uri (git-reference
243                (url "https://github.com/hellosiyan/Viewnior.git")
244                (commit (string-append name "-" version))))
245         (file-name (git-file-name name version))
246         (sha256
247          (base32
248           "0y4hk3vq8psba5k615w18qj0kbdfp5w0lm98nv5apy6hmcpwfyig"))))
249     (build-system meson-build-system)
250     (arguments
251      '(#:phases
252        (modify-phases %standard-phases
253          (add-after 'unpack 'patch-source
254            (lambda _
255              ;; Don't create 'icon-theme.cache'
256              (substitute* "meson.build"
257                (("meson.add_install_script*") ""))
258              #t)))
259        #:tests? #f)) ; no tests
260     (native-inputs
261      `(("gettext" ,gettext-minimal)
262        ("glib" ,glib "bin") ; glib-genmarshal
263        ("pkg-config" ,pkg-config)
264        ("shared-mime-info" ,shared-mime-info)))
265     (inputs
266      `(("exiv2" ,exiv2)
267        ("gdk-pixbuf" ,gdk-pixbuf)
268        ("gtk+-2" ,gtk+-2)))
269     (home-page "http://siyanpanayotov.com/project/viewnior")
270     (synopsis "Simple, fast and elegant image viewer")
271     (description "Viewnior is an image viewer program.  Created to be simple,
272 fast and elegant.  Its minimalistic interface provides more screenspace for
273 your images.  Among its features are:
274 @enumerate
275 @item Fullscreen & Slideshow
276 @item Rotate, flip, crop, save, delete images
277 @item Animation support
278 @item Browse only selected images
279 @item Navigation window
280 @item Set image as wallpaper (Gnome 2, Gnome 3, XFCE, LXDE, FluxBox, Nitrogen)
281 @item Simple interface
282 @item EXIF and IPTC metadata
283 @item Configurable mouse actions
284 @end enumerate\n")
285     (license license:gpl3+)))
287 (define-public catimg
288   (package
289     (name "catimg")
290     (version "2.5.0")
291     (source
292      (origin
293        (method git-fetch)
294        (uri (git-reference
295              (url "https://github.com/posva/catimg.git")
296              (commit version)))
297        (file-name (git-file-name name version))
298        (sha256
299         (base32 "0n74iczzgxrcq3zpa7ndycb9rinm829yvf81c747q4ngv5q6pzcm"))))
300     (build-system cmake-build-system)
301     (arguments
302      `(#:tests? #f                      ; no tests
303        #:phases
304        (modify-phases %standard-phases
305          (add-after 'unpack 'patch-convert
306            (lambda _
307              (substitute* "catimg"
308                ;; By replacing "convert", we also replace the "convert"
309                ;; in the message 'The version of convert is too old, don't
310                ;; expect good results :('.  This should not happen, but in
311                ;; practice this error message should not affect us.
312                (("convert") (which "convert")))
313              #t))
314          (add-after 'install 'install-script
315            (lambda* (#:key outputs #:allow-other-keys)
316              ;; The bash script lacks an file extension.  We have to rename
317              ;; it so that the C program and the bash script can be happy
318              ;; side by side.
319              (copy-file "../source/catimg"
320                         (string-append (assoc-ref outputs "out")
321                                        "/bin/catimg.sh"))
322              #t)))))
323     (inputs
324      `(("imagemagick" ,imagemagick))) ; for the bash script version
325     (home-page "https://github.com/posva/catimg")
326     (synopsis "Render images in the terminal")
327     (description
328      "Catimg is a little program that prints images in the terminal.
329 It supports JPEG, PNG and GIF formats.")
330     (license license:expat)))
332 (define-public luminance-hdr
333   (package
334     (name "luminance-hdr")
335     (version "2.4.0")
336     (source (origin
337               (method url-fetch)
338               (uri (string-append
339                     "mirror://sourceforge/qtpfsgui/luminance/"
340                     version "/luminance-hdr-" version ".tar.bz2"))
341               (sha256
342                (base32
343                 "00fldbcizrx8jcnjgq74n3zmbm27dxzl96fxa7q49689mfnlw08l"))
344               (patches (search-patches "luminance-hdr-qt-printer.patch"))))
345     (build-system cmake-build-system)
346     (native-inputs
347      `(("pkg-config" ,pkg-config)
348        ("qttools" ,qttools)))
349     (inputs
350      `(("qtbase" ,qtbase)
351        ("qtdeclarative" ,qtdeclarative)
352        ("qtwebkit" ,qtwebkit)
353        ("boost" ,boost)
354        ;; ("gtest" ,gtest)
355        ("libraw" ,libraw)
356        ("zlib" ,zlib)
357        ("exiv2" ,exiv2)
358        ("libpng" ,libpng)
359        ("libjpeg" ,libjpeg)
360        ("lcms" ,lcms)
361        ("openexr" ,openexr)
362        ("fftw" ,fftwf)
363        ("gsl" ,gsl)
364        ("libtiff" ,libtiff)))
365     (arguments
366      '(#:phases
367        (modify-phases %standard-phases
368          (add-after 'set-paths 'add-ilmbase-include-path
369            (lambda* (#:key inputs #:allow-other-keys)
370              ;; 'OpenEXR.pc' has a -I for IlmBase but 'FindOpenEXR.cmake' does
371              ;; not use 'OpenEXR.pc'.  Thus, we need to add
372              ;; "$ilmbase/include/OpenEXR/" to the CPATH.
373              (setenv "CPATH"
374                      (string-append (assoc-ref inputs "ilmbase")
375                                     "/include/OpenEXR"
376                                     ":" (or (getenv "CPATH") "")))
377              #t)))))
378     (home-page "http://qtpfsgui.sourceforge.net")
379     (synopsis "High dynamic range (HDR) imaging application")
380     (description
381      "Luminance HDR (formerly QtPFSGui) is a graphical user interface
382 application that aims to provide a workflow for high dynamic range (HDR)
383 imaging.  It supports several HDR and LDR image formats, and it can:
385 @itemize
386 @item Create an HDR file from a set of images (formats: JPEG, TIFF 8bit and
387 16bit, RAW) of the same scene taken at different exposure setting;
388 @item Save load HDR images;
389 @item Rotate, resize and crop HDR images;
390 @item Tone-map HDR images;
391 @item Copy EXIF data between sets of images.
392 @end itemize\n")
393     (license license:gpl2+)))
395 ;; CBR and RAR are currently unsupported, due to non-free dependencies.
396 ;; For optional PDF support, you can install the mupdf package.
397 (define-public mcomix
398   (package
399     (name "mcomix")
400     (version "1.2.1")
401     (source
402      (origin
403        (method url-fetch)
404        (uri (string-append "mirror://sourceforge/mcomix/MComix-" version
405                            "/mcomix-" version ".tar.bz2"))
406        (sha256
407         (base32
408          "0fzsf9pklhfs1rzwzj64c0v30b74nk94p93h371rpg45qnfiahvy"))))
409     (build-system python-build-system)
410     (inputs
411      `(("p7zip" ,p7zip)
412        ("python2-pillow" ,python2-pillow)
413        ("python2-pygtk" ,python2-pygtk)))
414     (arguments
415      ;; Python 2.5 or newer (Python 3 and up is not supported)
416      `(#:python ,python-2
417        #:tests? #f ; there are no tests
418        #:phases
419        (modify-phases %standard-phases
420          (add-after 'unpack 'configure
421            (lambda* (#:key inputs #:allow-other-keys)
422              (let ((p7zip (assoc-ref inputs "p7zip")))
423                ;; insert absolute path to 7z executable
424                (substitute* "mcomix/archive/sevenzip_external.py"
425                  (("_7z_executable = -1")
426                   (string-append "_7z_executable = u'" p7zip "/bin/7z'"))))
427              #t)))))
428     (home-page "https://sourceforge.net/p/mcomix/wiki/Home/")
429     (synopsis "Image viewer for comics")
430     (description "MComix is a customizable image viewer that specializes as
431 a comic and manga reader.  It supports a variety of container formats
432 including CBZ, CB7, CBT, LHA.")
433     (license license:gpl2+)))
435 (define-public qview
436   (package
437     (name "qview")
438     (version "2.0")
439     (source (origin
440               (method git-fetch)
441               (uri (git-reference
442                     (url "https://github.com/jurplel/qView.git")
443                     (commit version)))
444               (sha256
445                (base32
446                 "1s29hz44rb5dwzq8d4i4bfg77dr0v3ywpvidpa6xzg7hnnv3mhi5"))))
447     (build-system gnu-build-system)
448     (arguments
449      `(#:phases
450        (modify-phases %standard-phases
451          (replace 'configure
452            (lambda _
453              (invoke "qmake")))
454          ;; Installation process hard-codes "/usr/bin", possibly
455          ;; prefixed.
456          (add-after 'configure 'fix-install-directory
457            (lambda* (#:key outputs #:allow-other-keys)
458              (let ((out (assoc-ref outputs "out")))
459                (substitute* "Makefile"
460                  (("\\$\\(INSTALL_ROOT\\)/usr") out))
461                #t)))
462          ;; Don't phone home or show "Checking for updates..." in the
463          ;; About menu.
464          (add-before 'build 'disable-auto-update
465            (lambda _
466              (substitute* "src/qvaboutdialog.cpp"
467                (("ui->updateLabel->setText\\(updateText\\);") "")
468                (("requestUpdates\\(\\);") ""))
469              #t)))))
470     (inputs
471      `(("qtbase" ,qtbase)
472        ("qtsvg" ,qtsvg)
473        ("qtimageformats" ,qtimageformats)))
474     (home-page "https://interversehq.com/qview/")
475     (synopsis "Convenient and minimal image viewer")
476     (description "qView is a Qt image viewer designed with visually
477 minimalism and usability in mind.  Its features include animated GIF
478 controls, file history, rotation/mirroring, and multithreaded
479 preloading.")
480     (license license:gpl3+)))
482 (define-public chafa
483   (package
484     (name "chafa")
485     (version "1.0.1")
486     (source (origin
487               (method url-fetch)
488               (uri (string-append "https://hpjansson.org/chafa/releases/chafa-"
489                                   version ".tar.xz"))
490               (sha256
491                (base32
492                 "00cf2z52az0z6bzc3hfm4l8infipy5ck410wqmbaybd2csjr3m29"))))
493     (build-system gnu-build-system)
494     (native-inputs
495      `(("pkg-config" ,pkg-config)))
496     (inputs
497      `(("glib" ,glib)
498        ("imagemagick" ,imagemagick)))
499     (synopsis "Convert images to ANSI/Unicode characters")
500     (description
501      "Chafa is a command-line utility that converts all kinds of images,
502 including animated GIFs, into ANSI/Unicode character output that can be
503 displayed in a terminal.")
504     (home-page "https://hpjansson.org/chafa/")
505     (license license:lgpl3+)))