Mercurial > hg > digilib
annotate doc/src/site/markdown/scaler-api.md @ 1477:5a3bd01c8ed1
show/hide annotations button does work now.
| author | robcast |
|---|---|
| date | Tue, 19 Jan 2016 15:40:12 +0100 |
| parents | 71cd204862d4 |
| children | 4ef25f916df8 |
| 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 | |
| 1462 | 9 Recognised parameters (as of Version 2.3.7, for the most recent list of |
| 1273 | 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. | |
| 1462 | 61 - `colop`: color operation. One of |
| 62 - `GRAYSCALE` (produces grayscale image) | |
| 63 - `NTSC_GRAY` (uses NTSC formula to produce grayscale image) | |
| 64 - `BITONAL` (produces black-and-white image) | |
| 65 - `INVERT` (inverts colors) | |
| 66 - `MAP_GRAY_BGR` (produces false-color image mapping brightness values to color scale from blue via green to red). | |
| 1291 | 67 - `mo`: list of flags for the mode of operation separated by comma ",". |
| 1462 | 68 - `fit`: scale the image proportionally to fit inside \[`dw` x `dh`\], preserving its aspect ratio (default). |
| 69 - `squeeze`: scale the image to fit \[`dw` x `dh`\], changing its aspect ratio. | |
| 70 - `clip`: send the file in the highest resolution, cropped | |
| 1273 | 71 to fit \[`dw` x `dh`\]. |
| 72 - `osize`: scale to original size based on image | |
| 73 resolution (from the image metadata) and display resolution | |
| 74 (from parameter ddpi). Fails if either resolution is unknown. | |
| 75 - `ascale`: scale the highest resolution image by an absolute | |
| 76 factor given by the `scale` parameter. | |
| 77 - `file`: send the file as-is (may be very large and all | |
| 1291 | 78 sorts of image types!). If the configuration doesn't allow sending |
| 1273 | 79 files (`sendfile-allowed=false`) revert to `clip`. |
| 80 - `rawfile`: send the file as-is with a mime-type of | |
| 1291 | 81 "application/octet-stream" so the browser presents a download dialog. |
| 1273 | 82 - `errtxt`: send error response as plain text. |
| 83 - `errimg`: send error response as image (default). | |
| 84 - `errcode`: send error response as HTTP status code. | |
| 85 - `q0`-`q2`: quality of interpolation in scaling (q0: | |
| 1291 | 86 worst, q2 best). |
| 87 - `hires`: only use the highest resolution image. | |
| 1462 | 88 - `autores`: use the pre-scaled image that is bigger than the requested size (default). |
| 89 - `lores`: prefer the next-smaller pre-scaled image. | |
| 1273 | 90 - `vmir`: mirror image vertically. |
| 91 - `hmir`: mirror image horizontally. | |
| 92 - `jpg`: the resulting image is always sent as JPEG | |
| 93 (otherwise TIFF and PNG images are sent as PNG). | |
| 94 - `png`: the resulting image is always sent as PNG | |
| 95 (otherwise JPEG and J2K images are sent as JPEG). | |
| 1462 | 96 - `pxarea`: interpret `wx`, `wy`, `ww`, `wh` as pixel coordinates on the highest resolution image. |
| 1273 | 97 |
| 1291 | 98 The image to be loaded is specified by the `request_path` |
| 99 (deprecated) and/or the `fn` parameter (preferred) and the optional | |
| 1273 | 100 index `pn`: |
| 101 | |
| 102 - if `fn` points to a directory then the file with the index `pn` | |
| 103 (in alphabetical order according to ASCII) will be loaded | |
| 104 - if `fn` points to a file (with or without extension) then this | |
| 1291 | 105 file will be loaded (regardless of `pn`). |
| 1273 | 106 |
| 107 Find more information on the directory layout [here](image-directories.html). | |
| 108 | |
| 109 The image will always be scaled equally in horizontal and vertical direction, | |
| 1462 | 110 preserving the aspect ratio (except with `mo=squeeze`), |
| 1273 | 111 such that the resulting image does not exceed the rectangle \[`dw` x `dh`\]. |
| 112 | |
| 113 If only either height or width is given the image is scaled to match | |
| 114 only the given dimension. The size of the resulting image in the other | |
| 1462 | 115 dimension is determined by the aspect ratio of the image or the selected area. |
