PRITS_TOOLS::WRITE_IMAGE_REAL_SIZE - ITA-Solar/solo-spice-ql GitHub Wiki
Source code: prits_tools__write_image_real_size.pro
Class: PRITS_TOOLS
Description
This routine creates an image of the data including optional axis titles and ranges. The focus of this procedure is the size of the data image. The size of the image is calculated so that the data image itself has the exact desired size, by default the same size as the input data array, so that each pixel in the data array is represented by one pixel in the output file. The size of the image can be manipulated with the keywords SCALE_FACTOR, HEIGHT and WIDTH. The image can be saved in different file formats.
Syntax
prits_tools.write_image_real_size, IMAGE_DATA [, FILENAME] [, /REMOVE_TRENDS] [,SMOOTH=SMOOTH] [, COLORTABLE=COLORTABLE] [, FORMAT=FORMAT] [, XRANGE1=XRANGE1] [, XRANGE2=XRANGE2] [, YRANGE1=YRANGE1] [, YRANGE2=YRANGE2] [, XTITLE1=XTITLE1] [, XTITLE2=XTITLE2] [, YTITLE1=YTITLE1] [, YTITLE2=YTITLE2] [, TITLE=TITLE] [, BACKGROUND_COLOR=BACKGROUND_COLOR] [, TEXT_COLOR=TEXT_COLOR] [, BORDER=BORDER] [, SCALE_FACTOR=SCALE_FACTOR] [, HEIGHT=HEIGHT] [, WIDTH=WIDTH] [, /SCALE_TO_RANGE] [, /NO_AXIS] [, CUTOFF_THRESHOLD=CUTOFF_THRESHOLD] [, COLOR_CENTER_VALUE=COLOR_CENTER_VALUE] [, JPEG_QUALITY=JPEG_QUALITY] [, /SHOW_PLOT] [, /REVERSE_COLORTABLE] [, _EXTRA=_EXTRA]
Return value
This routine saves the image into a file.
Arguments
IMAGE_DATA
A 2-dimensional numeric array. This is the data/image to be plotted.
FILENAME
A string. The filename (and path) for the output file, in which the image should be saved. Default is 'image.xxx' (where xxx is the chosen file format) in the current directory.
Optional Input
SMOOTH:
An integer. The width of the boxcar used when smoothing the image using the smooth function. If not set no smoothing is performed.
COLORTABLE
An integer. The number of the color table to be used. See here for a list of color tables: https://www.l3harrisgeospatial.com/docs/loadingdefaultcolortables.html
FORMAT
A string, indicating the file format in which the image should be saved to. Possible values are BMP
, GIF
, JPEG
, PNG
, PPM
, SRF
, TIFF
, JPEG2000
(=JP2
). The default is JPEG.
XRANGE1
A 2-element numeric vector, indicating the data range displayed on the lower axis. If not provided, no tick marks will be shown on the lower axis.
XRANGE2
A 2-element numeric vector, indicating the data range displayed on the upper axis. If not provided, no tick marks will be shown on the upper axis.
YRANGE1
A 2-element numeric vector, indicating the data range displayed on the left axis. If not provided, no tick marks will be shown on the left axis.
YRANGE2
A 2-element numeric vector, indicating the data range displayed on the right axis. If not provided, no tick marks will be shown on the right axis.
XTITLE1
A string, that will be used as the title for the lower axis.
XTITLE2
A string, that will be used as the title for the upper axis.
YTITLE1
A string, that will be used as the title for the left axis.
YTITLE2
A string, that will be used as the title for the right axis.
TITLE
A string, that will be used as the title of the image. Note that providing both TITLE and XTITLE2 and/or XRANGE2 will result in a messy output.
BACKGROUND_COLOR
A 3-element byte vector, giving the color for the background of the image. Default is [255,255,255] (white).
TEXT_COLOR
A 3-element byte vector, giving the color of the axis and text in the image. Default is [0,0,0] (black).
BORDER
An integer giving the number of pixels that should be added around the image. The default is 5. If this is set to zero and none of the TITLE and RANGE inputs are provided, then the image is plotted with suppressed axis.
SCALE_FACTOR
A number. The data size is expanded by this factor. The default is 1.0.
HEIGHT
An integer giving the desired height of the data image. WIDTH is calculated if not provided. This is ignored if SCALE_FACTOR is provided.
WIDTH
An integer giving the desired width of the data image. HEIGHT is calculated if not provided. This is ignored if SCALE_FACTOR is provided.
CUTOFF_THRESHOLD
A fraction to be used in histo_opt to scale the image. The default is 0.02. Set to zero to suppress calling histo_opt.
COLOR_CENTER_VALUE
If provided, then this value will be set as the center of the color table. Useful for e.g. displaying velocity with a blue/red colortable.
JPEG_QUALITY
This keyword specifies the quality index, in the range of 0 (terrible) to 100 (excellent) for the JPEG file. The default value is 75, which corresponds to very good quality. Lower values of QUALITY produce higher compression ratios and smaller files. This input is ignored if the file format is not JPEG.
_EXTRA
Extra keywords sent to PIH and through it to PLOT and to WRITE_IMAGE and through it to WRITE_BMP, WRITE_GIF, WRITE_JPEG, WRITE_PNG, WRITE_PPM, WRITE_SRF, WRITE_TIFF and WRITE_JPEG2000.
Keywords
INTERPOLATION
If set, then the image is expanded with bilinear interpolation. This keyword should not be set, if SMOOTH input is provided.
REMOVE_TRENDS
If set, remove horizontal and vertical trends in the image
SCALE_TO_RANGE
If set, then the width/height ratio of the image will be adjusted to the given XRANGE1 and YRANGE1. If neither HEIGHT nor WIDTH is provided, then the width of the image will be adjusted. This keyword is ignored if XRANGE1 and YRANGE1 are not provided, or if both HEIGHT and WIDTH are provided.
NO_AXIS
If set, then no axis will be plotted, eventhough XRANGEn and/or YRANGEn is provided. Useful if you want to provide XRANGE1 and YRANGE1 to be able to set SCALE_TO_RANGE.
SHOW_PLOT
If set, then the image is shown on the screen and not saved into a file.
REVERSE_COLORTABLE
If set, then the colors of the given color table are reversed. Useful for e.g. ColorBrewer Schemes.