comparison common/doc/Scaler.html @ 903:7779b37d1d05

refactored into maven modules per servlet type. can build servlet-api 2.3 and 3.0 via profile now!
author robcast
date Tue, 26 Apr 2011 20:24:31 +0200
parents servlet/doc/Scaler.html@c9b2938861cf
children
comparison
equal deleted inserted replaced
902:89ba3ffcf552 903:7779b37d1d05
1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 <title>Scaler servlet</title>
6 </head>
7 <body>
8 <h1>Scaler</h1>
9
10 <p>A Servlet for scaling images. (Version 1.5.2)</p>
11
12 <h2>Web API</h2>
13
14 <p>The Scaler servlet takes parameters in the http request format:
15 <code>Scaler/request_path/?param1=value1&amp;param2=value2&amp;...</code>
16 Unknown parameters will be silently ignored.</p>
17
18 <p>Recognised parameters:</p>
19 <ul>
20 <li><b>request_path</b> path to file or directory.</li>
21
22 <li><b>fn</b> path to file or directory below <code>/docuserver/images</code>
23 (or other configured image directory).
24 This path will be added to the <code>request_path</code> behind the servlet name.
25 Either parameter can be empty.</li>
26
27 <li><b>pn</b> page number. Index into the (alphabetically sorted) directory
28 given by the path. Starts with 1. Ignored if the path points to a file.
29 Default: 1.</li>
30
31 <li><b>dw</b> destination image width (pixels). If omitted the image is scaled to fit
32 dh.</li>
33
34 <li><b>dh</b> destination image height (pixels). If omitted the image is scaled to fit
35 dw.</li>
36
37 <li><b>wx</b> relative x offset of the image area to be sent (0 &lt;= wx &lt;= 1).
38 Default: 0.</li>
39
40 <li><b>wy</b> relative y offset of the image area to be sent (0 &lt;= wy &lt;= 1).
41 Default: 0.</li>
42
43 <li><b>ww</b> relative width of the image area to be sent (0 &lt;= ww &lt;= 1).
44 Default: 1.</li>
45
46 <li><b>wh</b> relative height of the image area to be sent (0 &lt;= wh &lt;= 1).
47 Default: 1.</li>
48
49 <li><b>ws</b> additional scaling factor. The resulting image will have the size
50 <code>[ws*dw,ws*dh]</code>. Default: 1.</li>
51
52 <li><b>mo</b> flags for the mode of operation separated by ",".
53 <ul>
54 <li><b>fit</b>: always scale the image to fit
55 <code>[dw,dh]</code> (default).<br>
56
57 <b>clip</b>: send the file in its
58 original resolution, cropped to fit <code>[dw,dh]</code>.
59 <br>
60
61 <b>osize</b>: scale to original size based on the image resolution
62 (from the image metadata) and display resolution (from parameter
63 <code>ddpi</code>). Fails if either resolution is unknown.
64 </li>
65
66 <li>
67 <b>file</b>: send the file as-is (may
68 be very large and all sorts of image types!). If configuration
69 doesn't allow sending files
70 (<code>sendfile-allowed=false</code>) revert to
71 <code>clip</code>.<br>
72
73 <b>rawfile</b>: send the file as-is with a mime-type of
74 <code>application/octet-stream</code> so it can be downloaded with
75 the browser.
76 </li>
77
78 <li><b>errtxt</b>: send error response as HTML.<br>
79 <b>errimg</b>: response as image (default).</li>
80
81 <li><b>q0</b>-<b>q2</b>: quality of interpolation in scaling
82 (<code>q0</code>: worst, default).</li>
83
84 <li><b>lores</b>: try to use scaled image (default)<br>
85
86 <b>hires</b>: always use unscaled image.<br>
87
88 If the image is zoomed (ww, wh &lt; 1) the use of the scaled
89 image files depends on the requested resolution.</li>
90
91 <li><b>vmir</b>: mirror image vertically.<br>
92
93 <b>hmir</b>: mirror image horizontally.</li>
94
95 <li><b>jpg</b>: the resulting image is always sent as JPEG
96 (otherwise TIFF and PNG images are sent as PNG).
97 </li>
98 </ul>
99 </li>
100
101 <li><b>cont</b>: change contrast of the image. Negative value
102 reduces contrast, positive value enhances contrast. Pixel value is
103 multiplied by 2^cont. Default: 0</li>
104
105 <li><b>brgt</b>: change brightness of image. Negative value reduces
106 brightness, positive value enhances brightness. The value brgt is
107 added to the pixel value. Default: 0</li>
108
109 <li><b>rot</b>: rotate image. Rotation angle is given in
110 degrees. Default: 0</li>
111
112 <li><b>rgbm</b>: modify color by multiplication. The contrast of the
113 red green and blue components of the image can be reduced or
114 enhanced similar to the <code>cont</code> parameter. The factors for
115 red, green and blue are separated by slashes (for example
116 0.86/0/-0.5). Default: 0/0/0</li>
117
118 <li><b>rgba</b>: modify color by addition. The brightness of the red
119 green and blue components of the image can be reduced or enhanced
120 similar to the <code>brgt</code> parameter. The factors for red,
121 green and blue are separated by slashes (for example
122 100/0/25). Default: 0/0/0</li>
123
124 <li><b>ddpi</b>: resolution of client display for <code>osize</code> mode.
125 Either <code>ddpi</code> or <code>ddpix</code> and <code>ddpiy</code> must
126 be set to use <code>osize</code> mode.</li>
127
128 <li><b>ddpix</b>: resolution of client display in x direction for
129 <code>osize</code> mode.</li>
130
131 <li><b>ddpiy</b>: resolution of client display in y direction for
132 <code>osize</code> mode.</li>
133
134 </ul>
135
136 <p>The image to be loaded can be specified by the
137 <code>request_path</code> (deprecated) or the <code>fn</code>
138 (preferred) parameter and the optional index <code>pn</code></p>
139 <ul>
140 <li> if <code>fn</code> points to a directory then the file with
141 the index <code>pn</code> (in alphabetical order according to
142 ASCII) will be loaded</li>
143
144 <li>if <code>fn</code> points to a file (with or without
145 extension) then this file will be loaded</li>
146 </ul>
147
148 <p>The image will be scaled equally in horizontal and vertical
149 direction such that the resulting image does not exceed the rectangle
150 <code>[dw,dh]</code>. If only either height or width is given the
151 image is scaled to match only the given parameter. The size of the
152 resulting image in the other parameter is determined by the aspect
153 ratio of the image.
154 </p>
155
156 </body>
157 </html>