pyguymer3.image.save_array_as_image¶
- pyguymer3.image.save_array_as_image(img0, fname, /, *, calcAdaptive=True, calcAverage=True, calcNone=True, calcPaeth=True, calcSub=True, calcUp=True, chunksize=1048576, ct='grey', debug=True, dpi=None, exiftoolPath=None, form='png', gifsiclePath=None, jpegtranPath=None, modTime=None, optipngPath=None, pc_bot=0.0, pc_top=0.0, scale=False, timeout=60.0)[source]¶
Save an array as an image
This function accepts a NumPy array, with optional scaling and/or colour mapping, and saves it as an image. Currently only “png” and “ppm” formats are available.
- Parameters:
img0 (numpy.ndarray) – a 2D NumPy array of any type with shape (ny,nx)
fname (str) – output file name
calcAdaptive (bool, optional) – See
pyguymer3.image.makePng()for the documentation.calcAverage (bool, optional) – See
pyguymer3.image.makePng()for the documentation.calcNone (bool, optional) – See
pyguymer3.image.makePng()for the documentation.calcPaeth (bool, optional) – See
pyguymer3.image.makePng()for the documentation.calcSub (bool, optional) – See
pyguymer3.image.makePng()for the documentation.calcUp (bool, optional) – See
pyguymer3.image.makePng()for the documentation.chunksize (int, optional) – the size of the chunks of any files which are read in (in bytes)
ct (str, optional) – the colour table to apply (the default is no colour mapping, i.e., greyscale)
debug (bool, optional) – Print debug messages.
dpi (None or float or int, optional) – See
pyguymer3.image.makePng()for the documentation.exiftoolPath (str, optional) – the path to the “exiftool” binary (if not provided then Python will attempt to find the binary itself)
form (str, optional) – output image format
gifsiclePath (str, optional) – the path to the “gifsicle” binary (if not provided then Python will attempt to find the binary itself)
jpegtranPath (str, optional) – the path to the “jpegtran” binary (if not provided then Python will attempt to find the binary itself)
modTime (None or datetime.datetime, optional) – See
pyguymer3.image.makePng()for the documentation.optipngPath (str, optional) – the path to the “optipng” binary (if not provided then Python will attempt to find the binary itself)
pc_bot (float, optional) – the percentage to clip off the bottom of the histogram, if scaling is requested (default 0.0)
pc_top (float, optional) – the percentage to clip off the top of the histogram, if scaling is requested (default 0.0)
scale (bool, optional) – Does the input need scaling? If not, then the input array must be ≥ 0 and ≤ 255. (default False)
timeout (float, optional) – the timeout for any requests/subprocess calls
Notes
Copyright 2017 Thomas Guymer [1]
References