src/cirrus/builtins/tasks/add-preview/lambda_function.py
def create_thumbnail(filename, logger, scale_percent=5):
    """ Add a thumbnail to item, generated from filename """
    fnout = filename.replace('_preview.tif', '_thumb.png')
    logger.info(f"Creating thumbnail {fnout} from {filename}")
    try:
        gdal.Translate(fnout, filename, format='PNG', widthPct=scale_percent, heightPct=scale_percent)
        return {
            'title': 'Thumbnail image',
            'type': 'image/png',
            'roles': ['thumbnail'],
            'href': fnout
        }
    except Exception as err:
        logger.error(f"Unable to create thumbnail {fnout}: {err}")
        raise(err)
 Add a thumbnail to item, generated from filename 
Add a thumbnail to item, generated from filename
Add a thumbnail to item generated from filename
def create_thumbnail(filename, logger, scale_percent=5):
    fnout = filename.replace('_preview.tif', '_thumb.png')
    logger.info(f"Creating thumbnail {fnout} from {filename}")
    try:
        gdal.Translate(fnout, filename, format='PNG', widthPct=scale_percent, heightPct=scale_percent)
        return {
            'title': 'Thumbnail image',
            'type': 'image/png',
            'roles': ['thumbnail'],
            'href': fnout
        }
    except Exception as err:
        logger.error(f"Unable to create thumbnail {fnout}: {err}")
        raise(err)
def create_thumbnail ( filename , logger , scale_percent = 5 ) : fnout = filename . replace ( '_preview.tif' , '_thumb.png' ) logger . info ( f"Creating thumbnail {fnout} from {filename}" ) try : gdal . Translate ( fnout , filename , format = 'PNG' , widthPct = scale_percent , heightPct = scale_percent ) return { 'title' : 'Thumbnail image' , 'type' : 'image/png' , 'roles' : [ 'thumbnail' ] , 'href' : fnout } except Exception as err : logger . error ( f"Unable to create thumbnail {fnout}: {err}" ) raise ( err )
Add a thumbnail to item, generated from filename
Add a thumbnail to item generated from filename
""" Add a thumbnail to item, generated from filename """
filename
logger
scale_percent