### Navigation

- ☰
- PyTecplot-0.9 »
- Reference »

# Exporting

- tecplot.export
- export.save_jpeg()
- export.save_png()
- export.save_ps()
- export.save_tiff()
- export.save_wmf()

## tecplot.export

## export.save_jpeg()

`tecplot.export.``save_jpeg`(filename, width=800, region=<ExportRegion.CurrentFrame: 0>, supersample=3, encoding=<JPEGEncoding.Standard: 0>, quality=75)

  Save a JPEG image.

  Parameters: | filename (`string`) – filename with or without extension. (See note below conerning absolute and relative paths.) width (`integer`) – 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.CurrentFrame`) supersample (`integer`, 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) quality (`integer` 1-100, optional) – Select the quality of JPEG image. 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) encoding (`JPEGEncoding`, optional) – Encoding method for the JPEG 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`)
  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

  Unless file paths are absolute, saving and loading files will be relative to the current working directory of the parent process. This is different when running the PyTecplot script in batch mode and when running in connected mode with `tecplot.session.connect()`. In batch mode, paths will be relative to Python’s current working directory as obtained by `os.getcwd()`. When connected to an instance of Tecplot 360, paths will be relative to Tecplot 360’s‘ start-up folder which is typically the Tecplot 360 installation “bin” folder.

  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.load_layout('mylayout.lay')
      >>> 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.CurrentFrame: 0>, supersample=3, convert_to_256_colors=False)

  Save a PNG image.

  Parameters: | filename (`string`) – filename with or without extension. (See note below conerning absolute and relative paths.) width (`integer`) – 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.CurrentFrame`) supersample (`integer`, 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

  Unless file paths are absolute, saving and loading files will be relative to the current working directory of the parent process. This is different when running the PyTecplot script in batch mode and when running in connected mode with `tecplot.session.connect()`. In batch mode, paths will be relative to Python’s current working directory as obtained by `os.getcwd()`. When connected to an instance of Tecplot 360, paths will be relative to Tecplot 360’s‘ start-up folder which is typically the Tecplot 360 installation “bin” folder.

  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.load_layout('mylayout.lay')
      >>> 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.CurrentFrame: 0>, force_extra_3d_sorting=False, extra_precision=0, render_type=<PrintRenderType.Vector: 0>, resolution=150)

  Save a PostScript image.

  Parameters: | filename (`string`) – filename with or without extension. (See note below conerning absolute and relative paths.) palette (`Palette`, optional) – Export color image. (default: `Palette.Color`) 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.CurrentFrame`) force_extra_3d_sorting (`bool`, optional) – Force extra sorting for all 3D frames. (default: `False`) extra_precision (`int`, optional) – Additional digits for all numbers written to postscript file. (default: 0) render_type (`PrintRenderType`, optional) – Whether to render the postscript as a rasterized or vector image. (default: `PrintRenderType.Vector`) resolution (`integer`) – Resolution of the image in dots per inch. Larger values create more accurate plots, but result in larger file sizes. Note: this value is ignored if `PrintRenderType` is `PrintRenderType.Vector` (default: 150)
  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

  Unless file paths are absolute, saving and loading files will be relative to the current working directory of the parent process. This is different when running the PyTecplot script in batch mode and when running in connected mode with `tecplot.session.connect()`. In batch mode, paths will be relative to Python’s current working directory as obtained by `os.getcwd()`. When connected to an instance of Tecplot 360, paths will be relative to Tecplot 360’s‘ start-up folder which is typically the Tecplot 360 installation “bin” folder.

  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.CurrentFrame: 0>, supersample=3, convert_to_256_colors=False, gray_scale_depth=None, byte_order=<TIFFByteOrder.Intel: 0>)

  Save a TIFF image.

  Parameters: | filename (`string`) – filename with or without extension. (See note below conerning absolute and relative paths.) width (`integer`) – 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.CurrentFrame`) supersample (`integer`, 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 (`integer`, optional) – Export a gray-scale TIFF. 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) – Specify the byte order (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

  Unless file paths are absolute, saving and loading files will be relative to the current working directory of the parent process. This is different when running the PyTecplot script in batch mode and when running in connected mode with `tecplot.session.connect()`. In batch mode, paths will be relative to Python’s current working directory as obtained by `os.getcwd()`. When connected to an instance of Tecplot 360, paths will be relative to Tecplot 360’s‘ start-up folder which is typically the Tecplot 360 installation “bin” folder.

  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.load_layout('mylayout.lay')
      >>> 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.CurrentFrame: 0>, force_extra_3d_sorting=False)

  Save a Windows Metafile image

  Parameters: | filename (`string`) – filename with or without extension. (See note below conerning absolute and relative paths.) palette (`Palette`, optional) – Export color image. (default: `Palette.Color`) Note: `Palette.PenPlotter` cannot be used. 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.CurrentFrame`) force_extra_3d_sorting (`bool`, optional) – Force extra sorting for all 3D frames. (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

  Unless file paths are absolute, saving and loading files will be relative to the current working directory of the parent process. This is different when running the PyTecplot script in batch mode and when running in connected mode with `tecplot.session.connect()`. In batch mode, paths will be relative to Python’s current working directory as obtained by `os.getcwd()`. When connected to an instance of Tecplot 360, paths will be relative to Tecplot 360’s‘ start-up folder which is typically the Tecplot 360 installation “bin” folder.

  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')

### Navigation

- index
- modules |
- next |
- previous |