gdalextras.quicklook

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:
gdalextras.quicklook.autosize(xsize, ysize, datatype, memsize=307200.0)
Compute the output image size if not specified
gdalextras.quicklook.buildenv()
gdalextras.quicklook.compute_stats(src, bandid)
gdalextras.quicklook.create_vrtfile_flt(srcfname, vrtfname, srcband, srcwin, kernelsize, band=1)
Generate a GDAL virtual dataset for filtered bands computation
gdalextras.quicklook.create_vrtfile_mod(srcfname, vrtfname, srcband, srcwin, srcdtype, band=1)
Genarate a GDAl virtual dataset for module (and subfram) extraction
gdalextras.quicklook.handle_cmdline()
Handle command line arguments and options
gdalextras.quicklook.issubdataset_(fname)
gdalextras.quicklook.kernel_autosize(srcxsize, srcysize, outxsize, outysize)
Compute the filterig kernel size
gdalextras.quicklook.main()

Main function for quicklook generation.

Uses “sys.argv” for getting inputs.

gdalextras.quicklook.safe_open(srcfname, bandid)

Safely open the dataset and get the required raster band.

Return (dataset, band) or, in case of errors, print a message and exit.

gdalextras.quicklook.tosize(outsize, inputsize)

Convert size strings to integers.

Also handle size expressed in percentage format and perform some check.

gdalextras.quicklook.translatecmd(options, src, dst, bandid=1)

Generate the command line for “gdal_translate” execution.

The command line in returned in form of list of strings.

gdalextras.quicklook.vrtsource(srcfname, band, srcwin=None, kernelsize=0)
Generate XML for a GDAL virtual source

Previous topic

gdalextras.info

Next topic

gdalextras.vrtlib

This Page