Mercurial > hg > digilib
annotate doc/src/site/markdown/scaler-api.md @ 1417:e6ad329cfac8
more codec docs.
author | robcast |
---|---|
date | Thu, 22 Oct 2015 17:07:52 +0200 |
parents | bd333826fb7a |
children | 71cd204862d4 |
rev | line source |
---|---|
1273 | 1 # The digilib Scaler API |
2 | |
1291 | 3 The Scaler servlet takes parameters in the HTTP query string format: |
1273 | 4 |
1291 | 5 http://host.domain/digilib/Scaler/request_path/?param1=value1¶m2=value2&... |
1273 | 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 | |
1279
828b6c8b1b19
changed links in documentation (and poms) to new sourceforge site.
robcast
parents:
1273
diff
changeset
|
11 [use the source](https://sourceforge.net/p/digilib/code/ci/default/tree/servlet/src/main/java/digilib/conf/DigilibServletRequest.java) |
1273 | 12 ): |
13 | |
1291 | 14 - `request_path`: (optional) path to file or directory. |
15 - `fn`: path to file or directory. (This path will be added to | |
16 `request_path`. Either parameter can be empty. | |
17 All paths are relative to the configured base directory | |
18 from the [digilib-config.xml](digilib-config.html) parameter `basedir-list`). | |
1273 | 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 | |
1291 | 37 contrast, positive values enhance contrast. Each pixel value is |
1273 | 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 | |
1291 | 41 added to each pixel value. Default: 0 |
1273 | 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. | |
1291 | 61 - `colop`: color operation. One of "GRAYSCALE" (produces grayscale |
1273 | 62 image), "NTSC\_GRAY" (uses NTSC formula to produce grayscale image), |
1291 | 63 "INVERT" (inverts colors), "MAP\_GRAY\_BGR" (produces false-color image |
64 mapping brightness values to color scale from blue via green to red). | |
65 - `mo`: list of flags for the mode of operation separated by comma ",". | |
1273 | 66 - `fit`: always scale the image to fit \[`dw` x `dh`\] (default). |
67 - `clip`: send the file in its original resolution, cropped | |
68 to fit \[`dw` x `dh`\]. | |
69 - `osize`: scale to original size based on image | |
70 resolution (from the image metadata) and display resolution | |
71 (from parameter ddpi). Fails if either resolution is unknown. | |
72 - `ascale`: scale the highest resolution image by an absolute | |
73 factor given by the `scale` parameter. | |
74 - `file`: send the file as-is (may be very large and all | |
1291 | 75 sorts of image types!). If the configuration doesn't allow sending |
1273 | 76 files (`sendfile-allowed=false`) revert to `clip`. |
77 - `rawfile`: send the file as-is with a mime-type of | |
1291 | 78 "application/octet-stream" so the browser presents a download dialog. |
1273 | 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: | |
1291 | 83 worst, q2 best). |
84 - `lores`: try to use pre-scaled images (default) | |
85 - `hires`: only use the highest resolution image. | |
1273 | 86 - `vmir`: mirror image vertically. |
87 - `hmir`: mirror image horizontally. | |
88 - `jpg`: the resulting image is always sent as JPEG | |
89 (otherwise TIFF and PNG images are sent as PNG). | |
90 - `png`: the resulting image is always sent as PNG | |
91 (otherwise JPEG and J2K images are sent as JPEG). | |
92 | |
1291 | 93 The image to be loaded is specified by the `request_path` |
94 (deprecated) and/or the `fn` parameter (preferred) and the optional | |
1273 | 95 index `pn`: |
96 | |
97 - if `fn` points to a directory then the file with the index `pn` | |
98 (in alphabetical order according to ASCII) will be loaded | |
99 - if `fn` points to a file (with or without extension) then this | |
1291 | 100 file will be loaded (regardless of `pn`). |
1273 | 101 |
102 Find more information on the directory layout [here](image-directories.html). | |
103 | |
104 The image will always be scaled equally in horizontal and vertical direction, | |
105 preserving the aspect ratio, | |
106 such that the resulting image does not exceed the rectangle \[`dw` x `dh`\]. | |
107 | |
108 If only either height or width is given the image is scaled to match | |
109 only the given dimension. The size of the resulting image in the other | |
110 dimension is determined by the aspect ratio of the image. |