Generate a quicklook image from the input dataset.
This tool uses “gdal_translate” to generate a lightweight image (quicklook) optimized for direct viewing.
The tool perform the following operations:
- sub-image extraction (optional) [default: the entire image is processed]
- image resize (optional) [default: fit in 300 kbytes]
- image filtering based on moving window with configurable size (optional)
- data type conversion (optional) [default: 8 bit real]
- image stretching (optional) [default: dynamic fit in [mean-3*stddev, mean+3*stddev]
Almost all parameters are configurable an have defaults suitable for common tasks.
Note
this tool requires both “gdal_translate” and the “gdal-pixfun-plugin”. A virtual dataset with required behavior is produced by the tool (using pixel functions if needed) and then converted into an actual data file by means of “gdal_translate”.
Todo
configurable kernels
Todo
linear stretching computation based on the image histogram
Todo
check tmp files cleanup
Functions
| autosize(xsize, ysize, datatype[, memsize]) | Compute the output image size if not specified |
| buildenv() | |
| compute_stats(src, bandid) | |
| create_vrtfile_flt(srcfname, vrtfname, ...) | Generate a GDAL virtual dataset for filtered bands computation |
| create_vrtfile_mod(srcfname, vrtfname, ...) | Genarate a GDAl virtual dataset for module (and subfram) extraction |
| handle_cmdline() | Handle command line arguments and options |
| issubdataset_(fname) | |
| kernel_autosize(srcxsize, srcysize, ...) | Compute the filterig kernel size |
| main() | Main function for quicklook generation. |
| safe_open(srcfname, bandid) | Safely open the dataset and get the required raster band. |
| tosize(outsize, inputsize) | Convert size strings to integers. |
| translatecmd(options, src, dst[, bandid]) | Generate the command line for “gdal_translate” execution. |
| vrtsource(srcfname, band[, srcwin, kernelsize]) | Generate XML for a GDAL virtual source |
Classes
| OptionParser([usage, option_list, ...]) | Class attributes: |
Main function for quicklook generation.
Uses “sys.argv” for getting inputs.
Safely open the dataset and get the required raster band.
Return (dataset, band) or, in case of errors, print a message and exit.
Convert size strings to integers.
Also handle size expressed in percentage format and perform some check.
Generate the command line for “gdal_translate” execution.
The command line in returned in form of list of strings.