Mercurial > hg > digilib
annotate doc/src/site/markdown/image-directories.md @ 1417:e6ad329cfac8
more codec docs.
author | robcast |
---|---|
date | Thu, 22 Oct 2015 17:07:52 +0200 |
parents | aa09153a2b13 |
children |
rev | line source |
---|---|
1216
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
1 # Directory layout for images |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
2 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
3 In digilib all images are identified by the `fn` and (optional) `pn` parameters. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
4 The value for `fn` can be a directory path or a directory path and a filename, |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
5 separated by slashes, e.g. "`fn=books/book1/page0002`". |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
6 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
7 If `fn` is a directory path without filename `pn` is the index number of the |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
8 image files in this directory in alphabetical order, e.g. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
9 "`fn=books/book1&pn=2`". The default for `pn` is 1 i.e. the first image. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
10 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
11 If `fn` ends in a filename `pn` is ignored. File extensions are also ignored, |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
12 i.e. "`books/book1/page0002`" and "`books/book1/page0002.tif`" identify the same |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
13 image. It is recommended to omit the file extension. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
14 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
15 The directory path in `fn` is relative to the base directory in the `basedir-list` |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
16 parameter of the `digilib-config.xml` file, e.g. if |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
17 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
18 <parameter name="basedir-list" value="/docuserver/images" /> |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
19 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
20 and |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
21 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
22 fn=books/book1/page0002 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
23 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
24 then digilib will try to load the file |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
25 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
26 /docuserver/images/books/book1/page0002.tif |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
27 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
28 (automatically finding the right file extension) |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
29 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
30 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
31 ## Prescaled images |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
32 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
33 You can provide any number of scaled-down versions of your images that |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
34 digilib can use when a smaller version of an image is requested. Since less data |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
35 has to be read and processed this can speed up digilib's performance considerably. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
36 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
37 The actual process is that the client requests a certain target size, |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
38 digilib scans all available scaled-down versions of the same image, selects the |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
39 smallest image that is larger than the requested size and scales it down to the |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
40 requested size. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
41 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
42 There is another optimization in digilib: if the requested image is *exactly* |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
43 the same size and type as the pre-scaled image then the pre-scaled image is sent |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
44 unmodified to the client which is a lot faster. So it makes sense to produce |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
45 thumbnails of exactly 90 pixel width when they are used in an HTML page where |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
46 all images are 90 pixel wide. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
47 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
48 The scaled-down versions of the image have to have the same file name as |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
49 the original hi-res file. They can have a different type and extension (e.g. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
50 `img002.jpg` for `img002.TIFF`) |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
51 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
52 The scaled down images have to have the same directory path (the part that |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
53 shows up in digilib's "fn" parameter) as the hi-res file wile the first part of each |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
54 directory tree is configured by the `basedir-list` parameter in |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
55 `digilib-config.xml`. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
56 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
57 The sequence of directories in `basedir-list` is from high-res to low-res. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
58 Images must be present in the hires directory but they need not be present in |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
59 all lower-res directories. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
60 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
61 e.g. if digilib-config.xml contains |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
62 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
63 <parameter name="basedir-list" value="/images:/scaled:/thumb" /> |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
64 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
65 and a user requests the image `books/book1/page0002` digilib looks for |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
66 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
67 1. `/thumb/books/book1/page0002.jpg` |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
68 2. `/scaled/books/book1/page002.jpg` |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
69 3. `/images/books/book1/page002.tif` |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
70 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
71 (automatically finding the right file extension) |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
72 and uses the first image that is bigger than or equal to the requested size. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
73 |
1297 | 74 For batch-prescaling our images we use a very old Perl script called "scale-o-mat" |
75 that uses a lot of freely available imaging libraries (ImageMagick, libtiff, netpbm) | |
76 and is available in our [public CVS](https://it-dev.mpiwg-berlin.mpg.de/cvs/cgi-bin/cvsweb/scaleomat/). | |
1216
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
77 The script is given a |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
78 hi-res base directory, a destination base directory, a destination size and a |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
79 starting directory. It then processes all files in the starting directory and |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
80 all its subdirectories and creates scaled images in corresponding directories |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
81 under the destination base directory. |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
82 |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
83 We currently use prescaled thumbnails of 100 pixels and images for browser |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
84 display of 1500 pixels. Remember that the prescaled image has to be larger (or |
bd7dfa8b164e
move new digilib doc from https://it-dev.mpiwg-berlin.mpg.de/hg/digilib-doc into main repo.
robcast
parents:
diff
changeset
|
85 the same size) than the requested image size! |