| 239 | |
| 240 | '''Here is an attempt to define the different versions of the function:''' |
| 241 | |
| 242 | The most minimalistic versions of the function should assume band 1, 2 and 3 as being r, g, b and the quality equal to 75: |
| 243 | |
| 244 | ST_AsJPEG(raster) -quality = 75 |
| 245 | |
| 246 | A variant allow specifying the quality: |
| 247 | |
| 248 | ST_AsJPEG(raster, integer) |
| 249 | |
| 250 | Another variant should enable us to specify which band correspond to the r, the g and the b: |
| 251 | |
| 252 | ST_AsJPEG(raster, integer, integer, integer) - raster, rband, gband, bband, quality=75 |
| 253 | ST_AsJPEG(raster, integer, integer, integer, integer) - raster, rband, gband, bband, quality |
| 254 | |
| 255 | Another version should be designed to be used with a future ST_Band(raster) function. In this case there is no attempt to extract r, g or b band from any passed raster: |
| 256 | |
| 257 | ST_AsJPEG(raster, raster, raster) and ST_AsJPEG(raster, raster, raster, quality) |
| 258 | |
| 259 | Another series should allow converting 1 band raster with pixel of type 8BUI to a grayscale JPEG: |
| 260 | |
| 261 | ST_AsJPEG(raster, "GRAYSCALE") - convert only band 1 with quality = 75 |
| 262 | ST_AsJPEG(raster, "GRAYSCALE", integer) - convert only band 1 with specified quality |
| 263 | ST_AsJPEG(raster, integer, "GRAYSCALE") - allow specifying the band number to convert |
| 264 | ST_AsJPEG(raster, integer, "GRAYSCALE", integer) - allow specifying the band number to convert and the quality |
| 265 | |
| 266 | Another series should allow converting 1 band raster of ANY pixel type to a grayscale JPEG. Pixel types different than 8BUI should be mapped according to specified min, max values and a mapping mode: "MaxMinValue" (default) or "MaxMinType". |
| 267 | |
| 268 | ST_AsJPEG(raster, "GRAYSCALE", min, max, text) - convert only band 1 with quality = 75 |
| 269 | ST_AsJPEG(raster, "GRAYSCALE", integer, min, max, text) - convert only band 1 with specified quality |
| 270 | ST_AsJPEG(raster, integer, "GRAYSCALE", min, max, text) - allow specifying the band number to convert |
| 271 | ST_AsJPEG(raster, integer, "GRAYSCALE", integer, min, max, text) - allow specifying the band number to convert and the quality |
| 272 | |
| 273 | |