Save the Display
captureImage - Writes
panel display to a file
Usage: panel[0].captureImage(keywords)
Keywords - required:
file= |
name of file, file format determined by file extension; valid options: .jpg, .gif, .png, .ps, .pdf, .svg, .kml, and .kmz |
Keywords - optional:
height= |
height of image (default - see Remarks) |
width= |
width of image (default - see Remarks) |
quality= |
quality of jpg file (0.0 to 1.0); default=1.0; not used with other formats |
bgtransparent= |
captures image with transparent background; default=False |
formatting= |
various formatting options to apply to the output image |
- There are a variety of keywords that can be passed through the keyword parameter of captureImage. Below is a list of these formatting keywords and options for each of them. See the second example below for an example of passing various formatting options through captureImage with a dictionary.
- Clip - Clips the output image at a specific latitude/longitude location or at specific spacing into the image. By default, no clipping is done.
- north - Sets the north latitude to clip the image at.
- south - Sets the south latitude to clip the image at.
- east - Sets the east longitude to clip the image at.
- west - Sets the west longitude to clip the image at.
- space - Sets a pixel spacing in each direction to clip into the image.
Example: space=-50
Clips 50 pixels into the image in all four directions.
- hSpace - Sets a pixel spacing in the horizontal to clip into the image.
Example: hSpace=50
Clips 50 pixels into the image in both horizontal directions (left and right).
- vSpace - Sets a pixel spacing in the vertical to clip into the image.
Example: vSpace=20
Clips 20 pixels into the image in both vertical directions (top and bottom).
- Colorbar - Adds a colorbar to the output image. By default, no colorbar is added to the image.
- display - Sets the display to add the colorbar for. This is the name given to the layer at createLayer.
- width - Sets the horizontal width of the colorbar in pixels.
- height - Sets the vertical height of the colorbar in pixels.
- orientation - Sets the location of the tickmarks and labels with respect to the colorbar. Valid options for this keyword are "top", "bottom", "left", and "right". Default="bottom".
- tickmarks - Sets the number of tickmarks and labels to add to the colorbar. By default, no tickmarks or labels are added to the colorbar.
- interval - Sets the numerical interval to use between tickmarks and labels on the colorbar. By default, no tickmarks or labels are added to the colorbar.
- values - Sets specific numerical values to use for tickmarks and labels on the colorbar. By default, no tickmarks or labels are added to the colorbar.
- place - Sets the location the colorbar on the image along with x and y pixel offsets. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: place="LM,0,-30"
Places the colorbar in the lower middle and raises it 30 pixels from the bottom of the image.
Example: place="ML,50,0"
Places the colorbar in the middle left and indents it 50 pixels from the left of the image.
- anchor - Sets the location on the colorbar to center at the place. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: anchor="UM"
Sets the upper middle of the colorbar to be centered at the place specified.
- showLines - Includes lines on the colorbar at the tickmark and label locations. Valid options are "true" and "false". Default="false".
- showUnit - Includes a unit with the numerical labels on the colorbar. Valid options are "true" and "false". Default="false".
- suffix - Sets a label for the numerical labels on the colorbar. Note that this cannot be used in conjunction with showUnit.
Example: suffix="H"
Sets the labels on the colorbar to be "H".
- suffixFrequency - Sets which labels on the colorbar will show the unit or suffix. Valid options are "first", "last", and "all". Default="last".
- color - Sets the colors of the labels and lines. Default="black".
- lineColor - Sets the color of the lines on the colorbar, assuming showLines is set to true. Default=color or "black" if color has not been set.
- ImageOverlay - Adds an image, such as a logo, to the output image.
- image - Specifies the image to add to the output image.
- place - Sets the location of the image along with x and y pixel offsets. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: place="UL,20,20"
Adds the image to the upper left brought down 20 pixels from the top and brought in 20 pixels from the left.
- anchor - Sets the location on the image to center at the place. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: anchor="UM"
Sets the upper middle of the image to be centered at the place specified.
- transparency - Sets the transparency of the image. The valid values range from 0 to 1, 0 being completely opaque and 1 being 100% transparent. Default=0.
- Matte - Adds a matte to the output image. By default, no matte is added to the image.
- Background - Sets the background color of the matte. Default="white"
- top - Sets the size of the matte on the top of the image. Default=0.
Example: top=20
Adds a 20 pixel matte to the top of the image.
- bottom - Sets the size of the matte on the bottom of the image. Default=0.
Example: bottom=20
Adds a 20 pixel matte to the bottom of the image.
- left - Sets the size of the matte on the left of the image. Default=0.
Example: left=50
Adds a 50 pixel matte to the left of the image.
- right - Sets the size of the matte on the right of the image. Default=0.
Example: right=50
Adds a 50 pixel matte to the right of the image.
- space - Sets the size of the matte on all sides of the image. Default=0.
Example: space=25
Adds a 25 pixel matte to all sides of the image.
- hSpace - Sets the size of the matte on the left and right sides of the image. Default=0.
Example: hspace=10
Adds a 10 pixel matte to the left and right sides of the image.
- vSpace - Sets the size of the matte on the top and bottom of the image.
Example: vspace=20
Adds a 20 pixel matte to the top and bottom of the image.
- Resize - Resizes the output image. By default, no resize is done to the output image, and the image will be the same size as the display window.
- dimensions - Sets the size of the output image in either a pixel count or a percentage of the display window.
Example: dimensions=("400","300")
Creates a 400x300 pixel image.
Example: dimensions=("60%","80%")
Creates an image that is 60% in the x of the original display, and 80% in the y of the original display.
- TextOverlay - Adds text to the output image. By default, no text is added to the output image.
- text - Sets the text string to add to the output image.
Example: text="GOES East Image"
Adds the text of "GOES East Image" to the output image.
- place - Sets the location of the text along with x and y pixel offsets. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: place="UL,20,20"
Adds the text to the upper left brought down 20 pixels from the top and brought in 20 pixels from the left.
- anchor - Sets the location on the text to center at the place. Valid options are:
UL - Upper Left |
UM - Upper Middle |
UR - Upper Right |
ML - Middle Left |
MM - Middle Middle |
MR - Middle Right |
LL - Lower Left |
LM - Lower Middle |
LR - Lower Right |
Example: anchor="UM"
Sets the upper middle of the text string to be centered at the place specified.
- fontSize - Sets the size of the text.
- fontFace - Sets the font to use for the text.
- color - Sets the color of the text.
- background - Sets the background color for the text string. By default, this is not defined and there is no background for the text.
- transparency - Sets the transparency of the text. The valid values range from 0 to 1, 0 being completely opaque and 1 being 100% transparent. Default=0.
- TransparentBackground - Sets the background of the image to be transparent in the output image. By default, the background is not transparent. To capture an image with a transparent background, specify TransparentBackground() in the formatting keyword of captureImage.
Remarks:
If captureImage is used to save a panel that was created
with openBundle, the sizes default to size of the display window when the bundle
was saved. If data was loaded using createLayer, the sizes default to those
defined in buildWindow.
Example without formatting:
panel[0].captureImage('C:\\Users\\myuser\\Image.png')
Example with formatting:
myFormatting = [
Matte(
bottom="80",
top="80",
space="100",
),
Colorbar(
display=imLayer,
place="ML,50,0",
anchor="ML",
orientation="left",
interval="10",
width="25",
height="400",
),
ImageOverlay(
image='C:\\Users\\myuser\\logo3.png',
place="UR,-20,10",
anchor="UR",
),
TextOverlay(
text="GOES East Image",
place="LM,0,-40",
anchor="LM",
fontSize="30",
color="black",
),
]
panel[0].captureImage('C:\\Users\\myuser\\formattingExample.gif',formatting=myFormatting)
writeMovie - Writes
an image sequence to a movie file (ISL function)
Usage: writeMovie(keywords)
Keywords - required:
file= |
name of file, file format determined by file extension; valid options: .gif, .mov |
Keywords - optional:
resize width= height= |
size of image (default = height of window) |
Example:
writeMovie('C:\\Users\\myuser\\movie.gif',params='resize width=600 height=800')