[Go to Previous] [Go to Next]


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
createDirectories= creates the directory specified in the file keyword if it does not already exist when set to True; default=False
index= specifies the frame (index) in the display to capture when multiple frames are displayed in a loop. This is a 0-based list, where the first frame is index 0, the second frame is index 1, and so on; default=0
verbose= prints an informational line to the Jython Shell letting the user know that the image is in the process of being written; default=True
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.
If running in a foreground session, the image capture is created from the display on the monitor. Therefore, the user is limited to a window size that fits within the bounds of the monitor. Any windows created with buildWindow must also include the Main Toolbar and Viewpoint Toolbar buttons in the window. Therefore, there is also a minimum size the display window can be. If a user wishes to capture larger or smaller images in a foreground session, they must use setFullScreenWidth(), setFullScreenHeight(), and toggleFullScreen(). The setFullScreen functions accept numerical pixel values. From the background, buildWindow can be used for any size display.
Example of capturing a large image in a foreground session:
panel=buildWindow()
panel[0].setFullScreenWidth(1500)
panel[0].setFullScreenHeight(1350)
panel[0].toggleFullScreen()
panel[0].captureImage('C:/Users/myUser/Image.gif')
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, .mp4
Keywords - optional:
resize width= height= size of image (default = height of window)
globalPalette= sets if the animated GIF will use the color palette of each individual image or if the same colors will be used in each frame. Setting this to true helps to mitigate the flickering effect that can sometimes be seen in the color scale attached to the image. One circumstance where disabling this option may be ideal is if the movie starts with a low-light scene (not many colors) and there is no color scale in the display; default=True
createDirectories= creates the directory specified in the file keyword if it does not already exist when set to True; default=False
framesPerSecond= defines the number of frames to show each second in an animated GIF. The higher the number, the faster the GIF will play; default=2
endFramePause= defines the number of seconds to show the last frame in an animated GIF. The higher the number, the longer the last frame will be displayed before the animation returns to the beginning; default=2
Example:
writeMovie('C:/Users/myUser/movie.gif',params='resize width=600 height=800')

[Go to Previous] [Go to Next]