annotate common/doc/Scaler.html @ 1231:21441a3f5208

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