File: README.rst

package info (click to toggle)
fgallery 1.8.2-2
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 412 kB
  • ctags: 158
  • sloc: perl: 690; python: 213; makefile: 4
file content (344 lines) | stat: -rw-r--r-- 13,931 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
fgallery: a modern, minimalist javascript photo gallery
=======================================================

"fgallery" is a static photo gallery generator with no frills that has a
stylish, minimalist look. "fgallery" shows your photos, and nothing else.

You can see an example gallery at the following address:

https://www.thregr.org/~wavexx/software/fgallery/demo/

There is no server-side processing, only static generation. The resulting
gallery can be uploaded anywhere without additional requirements and works with
any modern browser.

- Automatically orients pictures without quality loss.
- Multi-camera friendly: automatically sorts pictures by time: just throw your
  (and your friends) photos and movies in a directory. The resulting gallery
  shows the pictures in seamless shooting order.
- Adapts to the current screen size and proportions, switching from
  horizontal/vertical layout and scaling thumbnails automatically.
- Supports face detection for improved thumbnail centering.
- Loads fast! Especially over slow connections.
- Includes original (raw) pictures in a zip file for downloading.
- Panoramas can be seen full-size by default.


Usage
-----

1) Generate all the static files with ./fgallery::

     ./fgallery photo-dir my-gallery

2) Upload "my-gallery" somewhere.

To test/preview the gallery locally using Firefox, you can just open the file
``my-gallery/index.html``. On other browsers you need a web server (due to AJAX
same-origin restrictions). If you have python installed, a quick way to test
the gallery locally is to run::

  cd my-gallery
  python -m SimpleHTTPServer 8000

and then navigate to http://localhost:8000.


Pre-built packages
------------------

Pre-built packages for `fgallery` (and `facedetect`) are available for Debian:

- https://packages.debian.org/fgallery
- https://packages.debian.org/facedetect

Arch Linux:

- https://aur.archlinux.org/packages/fgallery/

You can also try the latest `fgallery` bundled with facedetect_ in a Docker
container using the following ``Dockerfile`` provided by Stavros Korokithakis:

- https://github.com/skorokithakis/docker-fgallery


Usage notes
-----------

The images as shown by the viewer are scaled/compressed using the specified
quality to reduce viewing lag. They are also stripped of any EXIF tag. However,
the pictures in the generated zip album are preserved *unchanged*.

Lossless auto-rotation is applied so that images can be opened with a browser
directly. JPEG and PNG files are also re-optimized (losslessy) before being
archived to furthermore save space.

Image captions are read from simple text files or directly from EXIF metadata.
Captions can be controlled by the user using the "bubble" icon or by pressing
the "c" keyboard shortcut, which cycles between normal/always hidden/always
shown visualization modes.

Preview and thumbnail images are converted to the sRGB color-space by default,
which provides better results on normal displays and browsers without color
management support.

All images can be included to be viewed individually at full resolution in the
gallery by using the ``-i`` flag. Panoramas are automatically detected and the
original image is included in full-size by default, as often the image preview
alone doesn't give it justice.

For best results when shooting with multiple cameras (or friends), synchronize
the camera clocks before starting to take pictures. Just pick one camera's time
as the reference. By doing this the album is automatically shown in logical
shooting order instead of file-name order.

Never use the ``-s`` or ``-d`` flags. Let your friends and viewers download the
raw album at full resolution, not the downscaled crap. Don't make me angry.


Tuning thumbnail generation
---------------------------

The sizes of the thumbnails and the main image can be customized on the command
line with the appropriate flags. Two settings are available for the thumbnail
sizes: minimum (150x112) and maximum (267x200). Thumbnails will always be as
big as the minimum size, but they can be enlarged up to the specified maximum
depending on the screen orientation. The default settings are tuned for a
mostly-landscape gallery, but they can be changed as needed.

Images having a different aspect ratio (like panoramas) are cut and centered
instead of being scaled-to-fit, so that the thumbnail shows the central subject
of the image instead of a thin, unwatchable strip. When this happens, the
viewer shows a sign on the thumbnail along the cut edges (this effect can be
seen in the demo gallery).


Portraits and face detection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To simply favor photos shot in portrait format, invert the width/height of the
thumbnail sizes::

  ./fgallery --min-thumb 112x150 --max-thumb 200x267 ...

This will force the thumbnails to always fit vertically, at the expense of a
higher horizontal thumbnail strip.

If your photos are mixed and can contain people, faces or portraits, you can
enable face detection by using the ``-f`` flag and installing `facedetect
<https://www.thregr.org/~wavexx/software/facedetect/>`_.

Face detection will ensure that the thumbnails, especially when cut, will be
centered on the face of the subject. If face detection is enabled, there's
generally no need to increase the thumbnail size.


Image captioning
----------------

Several sources for image captions are automatically read by fgallery. These
can be customized though the ``-c`` flag in the command line, which consists of
a comma-separated list of any of the following:

:``txt``: Detached captions in a simple text file.
:``xmp``: Captions read from XMP sidecar metadata.
:``exif``: Captions read from EXIF metadata.
:``cmt``: Captions read from JPEG or PNG's built-in "comment" data.

You can disable caption extraction entirely by using ``-c none``. When multiple
methods are provided, the first available caption source is used. By default,
the method list is ``txt,xmp,exif``.

The ``txt`` method reads the caption from a text file that has the same name as
the image, but with ``txt`` extension (for example ``IMG1234.jpg`` reads from
``IMG1234.txt``). The first line of the file (which can be empty) constitutes
the title, with any following line becoming the description. These files can
either be written manually, or can be edited more conveniently using the
``utils/fcaption`` utility. ``fcaption`` accepts a list of filenames or
directories on the command line, and provides a simple visual interface to
quickly edit image captions in this format.

``XMP`` or ``EXIF`` captions can be edited easily with many other image
editing/previewing programs, such as Darktable_ (which writes XMP sidecar files
by default) or Geeqie_ (use Ctrl+K to bring up the metadata editor).

Both JPEG and PNG have a built-in comment field, but it's not read by default
as it's often abused by editing software to put attribution or copyright
information. When enabled, the comment is parsed as for ``txt`` files: the
first line is the title, with any subsequent line becoming the description.

Captions are intended to be short. Do not write long or distracting
descriptions. Captions should *never* contain copyright information.
*Do not abuse captions*.

.. _darktable: http://www.darktable.org/
.. _geeqie: http://geeqie.org/


Color management
----------------

A pledge
~~~~~~~~

Since every camera is different, and every monitor is different, some color
transformation is necessary to reproduce the colors on your monitor as
*originally* captured by the camera. `Color management`_ is an umbrella term
for all the techniques required to perform this task.

Most image-viewing software support color management to some degree, but it's
rarely configured properly on most systems except for Safari on Mac OSX. No
other browser, unfortunately, supports decent color management.

This causes the familiar effect of looking at the same picture from your laptop
and your tablet, and noticing that the blue of the sky is just slightly off, or
that colors look much more contrasty on one screen as opposed to the other.
Often the image *has* the information required for a more balanced color
reproduction, but the browser is just ignoring it.

We're writing this down because Firefox *has* built-in color-management
support, but it's disabled by default on all platforms. It's also ranking very
low on the list of improvements to make, with some bugs being open for years.
In an attempt to raise awareness, please complain/contribute to any of the
existing `bug reports`_, citing the `Technical details`_ on this web page.

.. _Color management: http://en.wikipedia.org/wiki/Color_management
.. _bug reports: https://bugzilla.mozilla.org/buglist.cgi?component=GFX%3A%20Color%20Management&product=Core&bug_status=__open__


Technical details
~~~~~~~~~~~~~~~~~

On Firefox, the installation of the following "Color Management" add-on is
recommended:

https://addons.mozilla.org/en-US/firefox/addon/color-management/

When installed, in the add-on configuration, you'll need to enable color
management for "All images" and restart the browser. Also, if you have a
multi-monitor setup, it's advisable to manually set the "Display profile" to
the external/calibrated screen, since FF won't automatically select the color
profile for the current monitor, and just default to the primary. Firefox has
also known bugs with LUT profiles, though the more common Matrix profiles seem
to work fine.

We understand that CM has a considerable impact on image rendering performance,
but strictly speaking CM doesn't need to be enabled on all images by default.
It would be perfectly fine to have an additional attribute on the image tag to
request CM. The current method of enabling CM only on images with an ICC
profile is clearly not adequate, since images without a profile should be
assumed to be in sRGB color-space already.

Because of the general lack of color management, `fgallery` transforms the
preview and thumbnail images from the built-in color profile to the sRGB
color-space by default. On most devices this will result in images appearing to
be *closer* to true colors with only minimal lack of absolute color depth. As
usual, no transformation is done on the original downloadable files.


Dependencies
------------

Frontend/viewer: none (static html/js/css)

Backend:

* ImageMagick (``imagemagick``, http://www.imagemagick.org)
* LittleCMS2 utilities (``liblcms2-utils``, http://www.littlecms.com/).
* Either:

  - ``exiftran`` (part of ``fbida``: http://www.kraxel.org/blog/linux/fbida/), or
  - ``exifautotran`` (part of ``libjpeg-progs``: http://libjpeg.sourceforge.net/).

* zip
* perl >= 5.14 (threading support enabled), with the following `required` modules:

  - Image::ExifTool (``libimage-exiftool-perl``: http://owl.phy.queensu.ca/~phil/exiftool/)

  and the following additional `recommended` modules:

  - Cpanel::JSON::XS (``libcpanel-json-xs-perl``)

Several other tools are supported, but are only used when installed.
Therefore it's also helpful to install:

* jpegoptim (http://www.kokkonen.net/tjko/projects.html, for JPEG size optimization)
* pngcrush (http://pmt.sourceforge.net/pngcrush/, for PNG size optimization)
* facedetect (https://www.thregr.org/~wavexx/software/facedetect/, for face detection)
* p7zip (http://www.7-zip.org/, for faster and higher-compression zip archiving)

On Debian/Ubuntu, you can install all the required dependencies with::

  sudo apt-get install imagemagick exiftran zip liblcms2-utils
  sudo apt-get install libimage-exiftool-perl libcpanel-json-xs-perl

To save more space in the generated galleries, we recommend installing also the
optional dependencies::

  sudo apt-get install jpegoptim pngcrush p7zip

``fcaption`` is written in Python and requires PyQT4. You can install the
required packages with::

  sudo apt-get install python-qt4

For face detection support, simply follow the `facedetect installation
instructions <https://www.thregr.org/~wavexx/software/facedetect/#dependencies>`_.

On a Mac, we recommend installing the dependencies using `MacPorts
<http://www.macports.org/>`_. After installing MacPorts, type::

  sudo port install imagemagick lcms2 jpeg jpegoptim pngcrush
  sudo port install p5-image-exiftool p5-cpanel-json-xs


Installation
------------

Installation is currently optional. If needed, copy the extracted directory to
a directory of your liking and link `fgallery` appropriately::

  sudo cp -r fgallery-X.Y /usr/local/share/fgallery
  sudo ln -s /usr/local/share/fgallery/fgallery /usr/local/bin


Authors and Copyright
---------------------

"fgallery" can be found at https://www.thregr.org/~wavexx/software/fgallery/

| "fgallery" is distributed under GPLv2+ (see COPYING) WITHOUT ANY WARRANTY.
| Copyright(c) 2011-2016 by wave++ "Yuri D'Elia" <wavexx@thregr.org>.

fgallery's GIT repository is publicly accessible at::

  git://src.thregr.org/fgallery

or at https://github.com/wavexx/fgallery


Extending fgallery
------------------

"fgallery" is composed of a backend (the "fgallery" script) and a viewer
(contained in the "view" directory). Both are distributed as one package, but
they are designed to be used also independently.

"fgallery" just cares about generating the image previews and the album data.
All the presentation logic however is inside the viewer.

It's relatively easy to generate the album data dynamically and just use the
viewer. This was my aim when I started to develop "fgallery", as it's much
easier to just modify an existing CMS instead of trying to reinvent the wheel.
All a backend has to do is provide a valid "data.json" at some prefixed
address. A plugin for a CMS such as `Gallery <http://galleryproject.org/>`_
should be very easy to implement.


TODO
----

- Handle videos too
- Add an "overview" mode, which shows a screenful of thumbnails.
- Allow to hide the thumbnails entirely.
- Improve EXIF/header display.