Mercurial > hg > digilib-doc
comparison src/site/markdown/scaler-api.md @ 12:9189ba27fcf8 default tip
merge
author | casties |
---|---|
date | Fri, 06 Sep 2013 11:06:00 +0200 |
parents | fa5a64d04471 |
children |
comparison
equal
deleted
inserted
replaced
11:38be9940e142 | 12:9189ba27fcf8 |
---|---|
1 # The digilib Scaler API | |
2 | |
3 The Scaler servlet takes parameters in the HTTP request format: | |
4 | |
5 Scaler/request_path/?param1=value1¶m2=value2&... | |
6 | |
7 Unknown parameters will be silently ignored. | |
8 | |
9 Recognised parameters (as of Version 2.2.2, for the most recent list of | |
10 parameters | |
11 [use the source](http://hg.berlios.de/repos/digilib/file/default/servlet/src/main/java/digilib/conf/DigilibServletRequest.java) | |
12 ): | |
13 | |
14 - `request_path`: path to file or directory. | |
15 - `fn`: path to file or directory. This path will be added to the | |
16 `request_path` behind the servlet name. Either parameter can be | |
17 empty. All paths are relative to the configured base directory | |
18 (digilib-config parameter `basedir-list`). | |
19 - `pn`: page number. Index into the (alphabetically sorted) | |
20 directory given by the path. Starts with 1. Ignored if the path | |
21 points to a file. Default: 1. | |
22 - `dw`: destination image width (pixels). If omitted the image is | |
23 scaled to fit `dh.` | |
24 - `dh`: destination image height (pixels). If omitted the image | |
25 is scaled to fit `dw`. | |
26 - `wx`: relative x offset of the image area to be sent (0 <= | |
27 `wx` <= 1). Default: 0. | |
28 - `wy`: relative y offset of the image area to be sent (0 <= | |
29 `wy` <= 1). Default: 0. | |
30 - `ww`: relative width of the image area to be sent (0 <= `ww` | |
31 <= 1). Default: 1. | |
32 - `wh`: relative height of the image area to be sent (0 <= `wh` | |
33 <= 1). Default: 1. | |
34 - `ws`: additional scaling factor. The resulting image will have | |
35 the size \[`ws`\*`dw` x `ws`\*`dh`\]. Default: 1. | |
36 - `cont`: change contrast of the image. Negative values reduce | |
37 contrast, positive values enhance contrast. Pixel value is | |
38 multiplied by 2^`cont`. Default: 0 | |
39 - `brgt`: change brightness of image. Negative value reduces | |
40 brightness, positive value enhances brightness. The value `brgt` is | |
41 added to the pixel value. Default: 0 | |
42 - `rot`: rotate image. Rotation angle is given in degrees. | |
43 Default: 0 | |
44 - `rgbm`: modify colour by multiplication. The contrast of the | |
45 red green and blue components of the image can be reduced or | |
46 enhanced similar to the `cont` parameter. The factors for red, green | |
47 and blue are separated by slashes (e.g. `0.86/0/-0.5`). | |
48 Default: `0/0/0` | |
49 - `rgba`: modify colour by addition. The brightness of the red | |
50 green and blue components of the image can be reduced or enhanced | |
51 similar to the `brgt` parameter. The factors for red, green and blue | |
52 are separated by slashes (e.g. `100/0/25`). Default: `0/0/0` | |
53 - `ddpi`: resolution of client display for `osize` mode. Either | |
54 `ddpi` or `ddpix` and `ddpiy` must be set to use `osize` mode. | |
55 - `ddpix`: resolution of client display in x direction for | |
56 `osize` mode. | |
57 - `ddpiy`: resolution of client display in y direction for | |
58 `osize` mode. | |
59 - `scale`: absolute scale factor applied to the highest resolution image | |
60 for `ascale` mode. | |
61 - `colop`: additional color operation. One of "GRAYSCALE" (produces grayscale | |
62 image), "NTSC\_GRAY" (uses NTSC formula to produce grayscale image), | |
63 "INVERT" (inverts colors), "MAP\_GRAY\_BGR" (produces false-color image). | |
64 - `mo`: list flags for the mode of operation separated by comma ",". | |
65 - `fit`: always scale the image to fit \[`dw` x `dh`\] (default). | |
66 - `clip`: send the file in its original resolution, cropped | |
67 to fit \[`dw` x `dh`\]. | |
68 - `osize`: scale to original size based on image | |
69 resolution (from the image metadata) and display resolution | |
70 (from parameter ddpi). Fails if either resolution is unknown. | |
71 - `ascale`: scale the highest resolution image by an absolute | |
72 factor given by the `scale` parameter. | |
73 - `file`: send the file as-is (may be very large and all | |
74 sorts of image types!). If configuration doesn't allow sending | |
75 files (`sendfile-allowed=false`) revert to `clip`. | |
76 - `rawfile`: send the file as-is with a mime-type of | |
77 "application/octet-stream" so it can be downloaded with the | |
78 browser. | |
79 - `errtxt`: send error response as plain text. | |
80 - `errimg`: send error response as image (default). | |
81 - `errcode`: send error response as HTTP status code. | |
82 - `q0`-`q2`: quality of interpolation in scaling (q0: | |
83 worst, default). | |
84 - `lores`: try to use scaled image (default) | |
85 - `hires`: always use the highest resolution image. | |
86 - If the image is zoomed (`ww`, `wh` \< 1) the use of the scaled | |
87 image files depends on the requested resolution. | |
88 - `vmir`: mirror image vertically. | |
89 - `hmir`: mirror image horizontally. | |
90 - `jpg`: the resulting image is always sent as JPEG | |
91 (otherwise TIFF and PNG images are sent as PNG). | |
92 - `png`: the resulting image is always sent as PNG | |
93 (otherwise JPEG and J2K images are sent as JPEG). | |
94 | |
95 The image to be loaded can be specified by the `request_path` | |
96 (deprecated) or the `fn` parameter (preferred) and the optional | |
97 index `pn`: | |
98 | |
99 - if `fn` points to a directory then the file with the index `pn` | |
100 (in alphabetical order according to ASCII) will be loaded | |
101 - if `fn` points to a file (with or without extension) then this | |
102 file will be loaded | |
103 | |
104 Find more information on the directory layout [here](image-directories.html). | |
105 | |
106 The image will always be scaled equally in horizontal and vertical direction, | |
107 preserving the aspect ratio, | |
108 such that the resulting image does not exceed the rectangle \[`dw` x `dh`\]. | |
109 | |
110 If only either height or width is given the image is scaled to match | |
111 only the given dimension. The size of the resulting image in the other | |
112 dimension is determined by the aspect ratio of the image. |