# Exporting¶

## Exporting Images¶

### export.save_bmp()¶

tecplot.export.save_bmp(filename, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False)[source]

Save a BMP image.

Parameters
• filename (str) – filename with or without extension. (See note below conerning absolute and relative paths.)

• width (int) – Specify a width in pixels for the generated image. A larger width increases the quality of your image. However, the greater the width, the longer it will take to export the image, and the larger the exported file. (default: 800)

• region (frame or ExportRegion, optional) – If region is a frame object, then the contents of the frame will be exported. If region is ExportRegion.CurrentFrame, then the contents of the currently active frame will be exported. If region is ExportRegion.AllFrames, then the smallest rectangle containing all frames will be exported. If region is ExportRegion.WorkArea, then everything shown in the workspace will be exported. (default: ExportRegion.AllFrames)

• supersample (int, optional) – Controls the amount of antialiasing used in the image. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Note

If exporting is taking an unusually long time, or you get an error message saying that the image cannot be exported, the most likely cause is that the image width you are trying to export is too large. Selecting a smaller image width will greatly speed up the export process. For an image export size of Length x Width, the file size for an uncompressed true color image is approximately Length x Width x 3. Memory requirements to export such an image can be up to twice this size. For 256-color images, the maximum file size is approximately Length x Width, but is usually less since all 256-color image files are compressed. However, the memory requirements for exporting are the same as they are for a true color uncompressed image.

Save a BMP image of the entire workspace with supersampling:

>>> from tecplot.constant import ExportRegion
>>> tecplot.export.save_bmp('image.bmp', width=600, supersample=3,
...                         region=ExportRegion.WorkArea)


### export.save_eps()¶

tecplot.export.save_eps(filename, palette=<Palette.Color: 2>, region=<ExportRegion.AllFrames: 1>, force_extra_3d_sorting=False, extra_precision=0, render_type=<PrintRenderType.Vector: 0>, resolution=150, preview_type=<EPSPreviewImage.TIFF: 1>, preview_width=128, preview_height=128, preview_gray_scale_depth=0)[source]

Save an Encapsulated PostScript image.

Parameters
Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Save an Ecapsulated PostScript image of the active frame:

>>> tecplot.load_layout('mylayout.lay')
>>> tecplot.export.save_eps('image.eps')


### export.save_jpeg()¶

tecplot.export.save_jpeg(filename, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, encoding=<JPEGEncoding.Standard: 0>, quality=75)[source]

Save a JPEG image.

Parameters
• filename (str) – filename with or without extension. (See note below conerning absolute and relative paths.)

• width (int) – Specify a width in pixels for the generated image. A larger width increases the quality of your image. However, the greater the width, the longer it will take to export the image, and the larger the exported file. (default: 800)

• region (frame or ExportRegion, optional) – If region is a frame object, then the contents of the frame will be exported. If region is ExportRegion.CurrentFrame, then the contents of the currently active frame will be exported. If region is ExportRegion.AllFrames, then the smallest rectangle containing all frames will be exported. If region is ExportRegion.WorkArea, then everything shown in the workspace will be exported. (default: ExportRegion.AllFrames)

• supersample (int, optional) – Controls the amount of antialiasing used in the image. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• encoding (JPEGEncoding, optional) –

file which may be one of the following: * JPEGEncoding.Standard Creates a JPEG which downloads one line at a time, starting at the top line. * JPEGEncoding.Progressive Creates a JPEG image that can be displayed with a “fade in” effect in a browser. This is sometimes useful when viewing the JPEG in a browser with a slow connection, since it allows an approximation of the JPEG to be drawn immediately, and the browser does not have to wait for the entire image to download.

(default: JPEGEncoding.Standard)

• quality (int 1-100, optional) – Higher quality settings produce larger files and better looking export images. Lower quality settings produce smaller files. For best results, use a quality setting of 75 or higher. (default: 75)

Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Note

If exporting is taking an unusually long time, or you get an error message saying that the image cannot be exported, the most likely cause is that the image width you are trying to export is too large. Selecting a smaller image width will greatly speed up the export process. For an image export size of Length x Width, the file size for an uncompressed true color image is approximately Length x Width x 3. Memory requirements to export such an image can be up to twice this size. For 256-color images, the maximum file size is approximately Length x Width, but is usually less since all 256-color image files are compressed. However, the memory requirements for exporting are the same as they are for a true color uncompressed image.

Create a new frame and save a JPEG image of the frame with quality 50 and supersampling:

>>> frame = tecplot.active_page().add_frame()
>>> tecplot.export.save_jpeg('image.jpeg', width=600, supersample=3,
...                         region=frame, quality=50)


### export.save_png()¶

tecplot.export.save_png(filename, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False)[source]

Save a PNG image.

Parameters
• filename (str) – filename with or without extension. (See note below conerning absolute and relative paths.)

• width (int) – Specify a width in pixels for the generated image. A larger width increases the quality of your image. However, the greater the width, the longer it will take to export the image, and the larger the exported file. (default: 800)

• region (frame or ExportRegion, optional) – If region is a frame object, then the contents of the frame will be exported. If region is ExportRegion.CurrentFrame, then the contents of the currently active frame will be exported. If region is ExportRegion.AllFrames, then the smallest rectangle containing all frames will be exported. If region is ExportRegion.WorkArea, then everything shown in the workspace will be exported. (default: ExportRegion.AllFrames)

• supersample (int, optional) – Controls the amount of antialiasing used in the image. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Note

If exporting is taking an unusually long time, or you get an error message saying that the image cannot be exported, the most likely cause is that the image width you are trying to export is too large. Selecting a smaller image width will greatly speed up the export process. For an image export size of Length x Width, the file size for an uncompressed true color image is approximately Length x Width x 3. Memory requirements to export such an image can be up to twice this size. For 256-color images, the maximum file size is approximately Length x Width, but is usually less since all 256-color image files are compressed. However, the memory requirements for exporting are the same as they are for a true color uncompressed image.

Save a PNG image of the entire workspace with supersampling:

>>> from tecplot.constant import ExportRegion
>>> tecplot.export.save_png('image.png', width=600, supersample=3,
...                         region=ExportRegion.WorkArea)


### export.save_ps()¶

tecplot.export.save_ps(filename, palette=<Palette.Color: 2>, region=<ExportRegion.AllFrames: 1>, force_extra_3d_sorting=False, extra_precision=0, render_type=<PrintRenderType.Vector: 0>, resolution=150)[source]

Save a PostScript image.

Parameters
Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Save a PostScript image of the active frame:

>>> tecplot.load_layout('mylayout.lay')
>>> tecplot.export.save_ps('image.ps')


### export.save_tiff()¶

tecplot.export.save_tiff(filename, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False, gray_scale_depth=None, byte_order=<TIFFByteOrder.Intel: 0>)[source]

Save a TIFF image.

Parameters
• filename (str) – filename with or without extension. (See note below conerning absolute and relative paths.)

• width (int) – Specify a width in pixels for the generated image. A larger width increases the quality of your image. However, the greater the width, the longer it will take to export the image, and the larger the exported file. (default: 800)

• region (frame or ExportRegion, optional) – If region is a frame object, then the contents of the frame will be exported. If region is ExportRegion.CurrentFrame, then the contents of the currently active frame will be exported. If region is ExportRegion.AllFrames, then the smallest rectangle containing all frames will be exported. If region is ExportRegion.WorkArea, then everything shown in the workspace will be exported. (default: ExportRegion.AllFrames)

• supersample (int, optional) – Controls the amount of antialiasing used in the image. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

• gray_scale_depth (int, optional) –

The gray_scale_depth parameter may be set to a depth of 1-8

gray_scale_depth specifies the number of shades of gray by how many bits of gray scale information is used per pixel. The larger the number of bits per pixel, the larger the resulting file.

Options are: * 0: On/Off One bit per pixel using an on/off strategy. All background pixels are made white (on), and all foreground pixels, black (off). This setting creates small files and is good for images with lots of background, such as line plots and contour lines. * 1: 1 Bit per Pixel One bit per pixel using gray scale values of pixels to determine black or white. Those pixels that are more than 50 percent gray are black; the rest are white. This setting creates small files that might be useful for a rough draft or a preview image. * 4: 4 Bits per Pixel Four bits per pixel resulting in sixteen levels of gray scale. This setting generates fairly small image files with a fair number of gray levels. This setting works well for most preview image purposes. * 8: 8 Bits per Pixel Eight bits per pixel resulting in 256 levels of gray. This setting is useful for full image representation, but the files generated by this setting can be large.

(default: None)

• byte_order (TIFFByteOrder, optional) – (Intel or Motorola) of the TIFF image. (Default: TIFFByteOrder.Intel)

Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Note

If exporting is taking an unusually long time, or you get an error message saying that the image cannot be exported, the most likely cause is that the image width you are trying to export is too large. Selecting a smaller image width will greatly speed up the export process. For an image export size of Length x Width, the file size for an uncompressed true color image is approximately Length x Width x 3. Memory requirements to export such an image can be up to twice this size. For 256-color images, the maximum file size is approximately Length x Width, but is usually less since all 256-color image files are compressed. However, the memory requirements for exporting are the same as they are for a true color uncompressed image.

Save a 4-bit gray scale TIFF image of the entire workspace with supersampling:

>>> from tecplot.constant import ExportRegion
>>> tecplot.export.save_tiff('image.tiff', width=600, supersample=2,
>>>                         region=ExportRegion.WorkArea,
>>>                         gray_scale_depth=4)


### export.save_wmf()¶

tecplot.export.save_wmf(filename, palette=<Palette.Color: 2>, region=<ExportRegion.AllFrames: 1>, force_extra_3d_sorting=False)[source]

Save a Windows Metafile image

Parameters
Raises

TecplotSystemError – The image could not be saved due to a file I/O error or invalid attribute.

Note

Absolute and relative paths with PyTecplot

Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling os.getcwd(). This is true for batch and connected modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

Note that backslashes must be escaped which is especially important for windows paths such as "C:\\Users" or "\\\\server\\path" which will resolve to "C:\Users" and "\\server\path" respectively. Alternatively, one may use Python’s raw strings: r"C:\Users" and r"\\server\path"

Note

WMF (Windows Metafile) is a Microsoft vector graphics format widely accepted by Windows applications. Since WMFs are vector graphics, they can be easily resized by the importing application without the introduction of visual artifacts, but they cannot accurately represent plots with translucency or smooth color gradations

Save a WMF image of the active frame:

>>> tecplot.load_layout('mylayout.lay')
>>> tecplot.export.save_wmf('image.wmf')


## Exporting Video¶

### export.animation_avi()¶

tecplot.export.animation_avi(filename, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, compression=None, multiple_color_tables=False)[source]

Frame-by-frame AVI animation context.

Parameters

This is a context manager and must be invoked using the with statement. The returned object of the context manager is used to control when each frame of the video is captured. This is done using the context method animation.export_animation_frame() as shown in the example below, at which point the specified region or plot is rendered. The actual video file is produced upon exit of the context.

Typical code looks like the following (see the example under animation_mpeg4 for a complete working example):

>>> with tp.export.animation_avi('output.avi') as ani:
...     # make some view changes here
...     ani.export_animation_frame()


### export.animation_mpeg4()¶

tecplot.export.animation_mpeg4(filename, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, format_options=None)[source]

Frame-by-frame MPEG4 animation context.

Parameters
• filename (str) – The resulting video file name or path, relative to Python’s current working directory.

• width (int, optional) – The width of the video in pixels. (default: 800)

• animation_speed (int, optional) – The frame-rate of the video in frames per second. (default: 10)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• format_options (str, optional) – A string of options passed directly to the underlying application FFmpeg. By default, this will be “-c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p”.

This is a context manager and must be invoked using the with statement. The returned object of the context manager is used to control when each frame of the video is captured. This is done using the context method animation.export_animation_frame() as shown in the example below, at which point the specified region or plot is rendered. The actual video file is produced upon exit of the context.

Example usage:

import argparse, os

import tecplot as tp
from tecplot.constant import *

def parse_args():
"""
This script is to be run from the command line and accepts the
following command line arguments. Run this script with "--help"
to see usage and help information.
"""
parser = argparse.ArgumentParser()
help='connect to TecUtil Server')
help='port to use when connecting to TecUtil Server')
help='number of frames to produce in video')
help='output file name')
return parser.parse_args()

def setup_plot():
"""
Load the F-18 dataset from Tecplot 360's examples and show the
jet surface in 3D.
"""
tp.new_layout()
exdir = tp.session.tecplot_examples_directory()
datafile = os.path.join(exdir, 'SimpleData', 'F18.plt')

frame = tp.active_frame()
frame.show_border = False
plot = frame.plot(PlotType.Cartesian3D)
plot.activate()

plot.contour(0).variable = ds.variable('S')
plot.show_contour = True
return plot

def translate_view(view, x=0, y=0, z=0):
"""
Translate the viewer with respect to the data.
"""
p = view.position
view.position = p.x + x, p.y + y, p.z + z

def create_animation(outfile, plot, nframes):
"""
Using the tp.export.animation_mpeg4() context manager, the F-18 is
recorded doing an "aileron roll" by rotating and translating the
viewer with respect to the data by a small amount and capturing
each frame of the animation with a call to ani.export_animation_frame()
"""
with tp.session.suspend():
opts = dict(
width=400,
animation_speed=30,
supersample=3,
)
view = plot.view
translate_view(view, -15)
with tp.export.animation_mpeg4(outfile, **opts) as ani:
for i in range(args.nframes):
view.rotate_axes(5, (1, 0, 0))
translate_view(view, 30 / args.nframes)
ani.export_animation_frame()

"""
This script is meant to run on the command line. Run with "--help" to see
the F-18 dataset from Tecplot 360's examples directory and produces a
video of the model doing an "aileron roll" by manipulating the viewer
position.
"""
args = parse_args()
if args.connect:
tp.session.connect(port=args.port)
plot = setup_plot()
create_animation(args.outfile, plot, args.nframes)
print('video file created:', args.outfile)


### export.animation_wmv()¶

tecplot.export.animation_wmv(filename, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, format_options=None)[source]

Frame-by-frame WMV animation context.

Parameters

This is a context manager and must be invoked using the with statement. The returned object of the context manager is used to control when each frame of the video is captured. This is done using the context method animation.export_animation_frame() as shown in the example below, at which point the specified region or plot is rendered. The actual video file is produced upon exit of the context.

Typical code looks like the following (see the example under animation_mpeg4 for a complete working example):

>>> with tp.export.animation_wmv('output.wmv') as ani:
...     # make some view changes here
...     ani.export_animation_frame()


### export.animation_flash()¶

tecplot.export.animation_flash(filename, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, compression=None, image_type=<FlashImageType.Lossless: 0>)[source]

Frame-by-frame Flash animation context.

Parameters

This is a context manager and must be invoked using the with statement. The returned object of the context manager is used to control when each frame of the video is captured. This is done using the context method animation.export_animation_frame() as shown in the example below, at which point the specified region or plot is rendered. The actual video file is produced upon exit of the context.

Typical code looks like the following (see the example under animation_mpeg4 for a complete working example):

>>> with tp.export.animation_flash('output.flv') as ani:
...     # make some view changes here
...     ani.export_animation_frame()


### export.animation_raster_metafile()¶

tecplot.export.animation_raster_metafile(filename, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, multiple_color_tables=False)[source]

Frame-by-frame Raster Metafile animation context.

Parameters

This is a context manager and must be invoked using the with statement. The returned object of the context manager is used to control when each frame of the video is captured. This is done using the context method animation.export_animation_frame() as shown in the example below, at which point the specified region or plot is rendered. The actual video file is produced upon exit of the context.

Typical code looks like the following (see the example under animation_mpeg4 for a complete working example):

>>> with tp.export.animation_raster_metafile('output.rm') as ani:
...     # make some view changes here
...     ani.export_animation_frame()


### export.animation.animation.export_animation_frame()¶

tecplot.export.animation.animation.export_animation_frame(self)

Append a frame to the current animation.

This function is available as a method on the object returned by the animation contexts:

It instructs Tecplot 360 to capture the current state of the plot or workspace (see the region parameter in the contexts above) as a single frame in the resulting animation. Typical usage is to make small changes to the plot, calling animation.export_animation_frame() after each change to create a smooth transition from one view to another. For a detailed example, see animation_mpeg4. The following example is an excerpt from the MPEG-4 example code:

with tp.export.animation_mpeg4(outfile, **opts) as ani:
for i in range(args.nframes):
view.rotate_axes(5, (1, 0, 0))
translate_view(view, 30 / args.nframes)
ani.export_animation_frame()


### export.save_time_animation_avi()¶

tecplot.export.save_time_animation_avi(filename, start_time=None, end_time=None, timestep_step=1, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, compression=None, multiple_color_tables=False)[source]

Export transient data time-series AVI animation to a file.

Parameters

Example usage, see the example under save_time_animation_mpeg4 for a complete working example:

>>> tp.export.save_time_animation_avi('output.avi')


### export.save_time_animation_mpeg4()¶

tecplot.export.save_time_animation_mpeg4(filename, start_time=None, end_time=None, timestep_step=1, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, format_options=None)[source]

Export transient data time-series MPEG-4 animation to a file.

Parameters
• filename (str) – The resulting video file name or path, relative to Python’s current working directory.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• animation_speed (int, optional) – The frame-rate of the video in frames per second. (default: 10)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• format_options (str, optional) –

A string of options passed directly to the underlying application FFmpeg. By default, this will be “-c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p”.

Example usage:

import os

import tecplot as tp
from tecplot.constant import *

examples = tp.session.tecplot_examples_directory()
datafile = os.path.join(examples, 'SimpleData', 'VortexShedding.plt')

plot = tp.active_frame().plot(PlotType.Cartesian2D)
plot.activate()
plot.show_contour = True

plot.axes.x_axis.min = -0.002
plot.axes.x_axis.max = 0.012
plot.axes.y_axis.min = -0.006
plot.axes.y_axis.max = 0.006

tp.export.save_time_animation_mpeg4('vortex_shedding.mp4',
start_time=0, end_time=0.0006,
width=400, supersample=3)


### export.save_time_animation_wmv()¶

tecplot.export.save_time_animation_wmv(filename, start_time=None, end_time=None, timestep_step=1, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, format_options=None)[source]

Export transient data time-series Windows Media Video (WMV) to a file.

Parameters
• filename (str) – The resulting video file name or path, relative to Python’s current working directory.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• animation_speed (int, optional) – The frame-rate of the video in frames per second. (default: 10)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• format_options (str, optional) –

A string of options passed directly to the underlying application FFmpeg. By default, this will be “-qscale 4”.

Example usage, see the example under save_time_animation_mpeg4 for a complete working example:

>>> tp.export.save_time_animation_wmv('output.wmv')


### export.save_time_animation_flash()¶

tecplot.export.save_time_animation_flash(filename, start_time=None, end_time=None, timestep_step=1, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, compression=None, image_type=<FlashImageType.Lossless: 0>)[source]

Export transient data time-series Flash animation to a file.

Parameters

Example usage, see the example under save_time_animation_mpeg4 for a complete working example:

>>> tp.export.save_time_animation_flash('output.flv')


### export.save_time_animation_raster_metafile()¶

tecplot.export.save_time_animation_raster_metafile(filename, start_time=None, end_time=None, timestep_step=1, width=800, animation_speed=10, region=<ExportRegion.AllFrames: 1>, supersample=3, multiple_color_tables=False)[source]

Export transient data time-series Raster Metafile animation to a file.

Parameters
• filename (str) – The resulting video file name or path, relative to Python’s current working directory.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• animation_speed (int, optional) – The frame-rate of the video in frames per second. (default: 10)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• multiple_color_tables (bool, optional) – Create a color table for each frame of the animation. If False (default), the whole animation will be scanned in an attempt to create a single table of 256 colors.

Example usage, see the example under save_time_animation_mpeg4 for a complete working example:

>>> tp.export.save_time_animation_raster_metafile('output.rm')


### export.save_time_animation_bmp()¶

tecplot.export.save_time_animation_bmp(filename, start_time=None, end_time=None, timestep_step=1, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False)[source]

Export transient data time-series animation as BMP image files.

Parameters
• filename (str) – Each frame of the animation will be exported to image files that will include and underscore followed by the frame number padded to six digits with zeros just before the last period. For example, a filename of img.ext that exports three frames will create the files: img_000001.ext, img_000002.ext and img_000003.ext.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

The following example will create a series of image files named img_000001.bmp, img_000002.bmp, etc.:

tp.export.save_time_animation_bmp('img.bmp')


New in version 2018.2: Exporting animations as images requires Tecplot 360 2018 R2 or later.

### export.save_time_animation_jpeg()¶

tecplot.export.save_time_animation_jpeg(filename, start_time=None, end_time=None, timestep_step=1, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, encoding=<JPEGEncoding.Standard: 0>, quality=75)[source]

Export transient data time-series animation as JPEG image files.

Parameters
• filename (str) – Each frame of the animation will be exported to image files that will include and underscore followed by the frame number padded to six digits with zeros just before the last period. For example, a filename of img.ext that exports three frames will create the files: img_000001.ext, img_000002.ext and img_000003.ext.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• encoding (JPEGEncoding, optional) –

file which may be one of the following: * JPEGEncoding.Standard Creates a JPEG which downloads one line at a time, starting at the top line. * JPEGEncoding.Progressive Creates a JPEG image that can be displayed with a “fade in” effect in a browser. This is sometimes useful when viewing the JPEG in a browser with a slow connection, since it allows an approximation of the JPEG to be drawn immediately, and the browser does not have to wait for the entire image to download.

(default: JPEGEncoding.Standard)

• quality (int 1-100, optional) – Higher quality settings produce larger files and better looking export images. Lower quality settings produce smaller files. For best results, use a quality setting of 75 or higher. (default: 75)

The following example will create a series of image files named img_000001.jpeg, img_000002.jpeg, etc.:

tp.export.save_time_animation_jpeg('img.jpeg')


New in version 2018.2: Exporting animations as images requires Tecplot 360 2018 R2 or later.

### export.save_time_animation_png()¶

tecplot.export.save_time_animation_png(filename, start_time=None, end_time=None, timestep_step=1, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False)[source]

Export transient data time-series animation as PNG image files.

Parameters
• filename (str) – Each frame of the animation will be exported to image files that will include and underscore followed by the frame number padded to six digits with zeros just before the last period. For example, a filename of img.ext that exports three frames will create the files: img_000001.ext, img_000002.ext and img_000003.ext.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

The following example will create a series of image files named img_000001.png, img_000002.png, etc.:

tp.export.save_time_animation_png('img.png')


New in version 2018.2: Exporting animations as images requires Tecplot 360 2018 R2 or later.

### export.save_time_animation_tiff()¶

tecplot.export.save_time_animation_tiff(filename, start_time=None, end_time=None, timestep_step=1, width=800, region=<ExportRegion.AllFrames: 1>, supersample=3, convert_to_256_colors=False, gray_scale_depth=None, byte_order=<TIFFByteOrder.Intel: 0>)[source]

Export transient data time-series animation as TIFF image files.

Parameters
• filename (str) – Each frame of the animation will be exported to image files that will include and underscore followed by the frame number padded to six digits with zeros just before the last period. For example, a filename of img.ext that exports three frames will create the files: img_000001.ext, img_000002.ext and img_000003.ext.

• start_time (float, optional) – The beginning solution time of the animation. This defaults to the earliest solution time in the dataset.

• end_time (float, optional) – The ending solution time of the animation. This defaults to the latest solution time in the dataset.

• timestep_step (int, optional) – The number of timesteps to increments for each frame of the animation. (default: 1)

• width (int, optional) – The width of the video in pixels. (default: 800)

• region (Frame or ExportRegion, optional) – The rectangular area to be exported. This can be a specific Frame object or one of ExportRegion.CurrentFrame, ExportRegion.AllFrames (default) or ExportRegion.WorkArea.

• supersample (int, optional) – Controls the amount of anti-aliasing used in each frame. Valid values are 1-16. A value of 1 indicates that no antialiasing will be used. Antialiasing smooths jagged edges on text, lines, and edges of the video output by the process of supersampling. Some graphics cards can cause Tecplot 360 to crash when larger anti-aliasing values are used. If this occurs on your machine, try updating your graphics driver or using a lower anti-aliasing value. (default: 3)

• convert_to_256_colors (Boolean, optional) – Pass True to generate an image with no more than 256 colors (reduced from a possible 16 million colors). Tecplot 360 selects the best color match. The image will have a greatly reduced file size, but for plots with many colors, the results may be suboptimal. If this option is used with transparency, smooth color gradations, or antialiasing may result in poor image quality. (default: False)

• gray_scale_depth (int, optional) –

The gray_scale_depth parameter may be set to a depth of 1-8

gray_scale_depth specifies the number of shades of gray by how many bits of gray scale information is used per pixel. The larger the number of bits per pixel, the larger the resulting file.

Options are: * 0: On/Off One bit per pixel using an on/off strategy. All background pixels are made white (on), and all foreground pixels, black (off). This setting creates small files and is good for images with lots of background, such as line plots and contour lines. * 1: 1 Bit per Pixel One bit per pixel using gray scale values of pixels to determine black or white. Those pixels that are more than 50 percent gray are black; the rest are white. This setting creates small files that might be useful for a rough draft or a preview image. * 4: 4 Bits per Pixel Four bits per pixel resulting in sixteen levels of gray scale. This setting generates fairly small image files with a fair number of gray levels. This setting works well for most preview image purposes. * 8: 8 Bits per Pixel Eight bits per pixel resulting in 256 levels of gray. This setting is useful for full image representation, but the files generated by this setting can be large.

(default: None)

• byte_order (TIFFByteOrder, optional) – (Intel or Motorola) of the TIFF image. (Default: TIFFByteOrder.Intel)

The following example will create a series of image files named img_000001.tiff, img_000002.tiff, etc.:

tp.export.save_time_animation_tiff('img.tiff')


New in version 2018.2: Exporting animations as images requires Tecplot 360 2018 R2 or later.