### Navigation

- ☰
- PyTecplot-0.8 »
- Reference »

# Exporting

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

## tecplot.export

## export.save_png()

`tecplot.export.``save_png`(filename, width, region=None, supersample=None, convert_to_256_colors=None)

  Save a PNG image.

  Parameters: | filename (`string`) – filename with or without extension. 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. 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 2-16. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. A large intermediate image is rendered and then reduced to the final image size. Each pixel on the final image is created from multiple rendered pixels. The width and height of the intermediate image are the width and height of the final image times some scale factor. This scale factor is the Supersample Factor. You can use values from 2 to 16. Factors greater than 3 are seldom necessary. Large scale factors take a lot more time and memory. Some graphics cards limit the dimensions of rendered images to a maximum of 2048x2048 or 4096x4096 pixels, and thus Tecplot cannot antialias if the intermediate image would be larger than this limit. Antialiasing uses many colors. Antialiasing with 256 colors wastes time and may decrease plot quality. (default: `None`) 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: `None`)
  Raises: | `TecplotSystemError` – The image could not be saved due to a file I/O error or invalid attribute.

  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:

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

## export.save_tiff()

`tecplot.export.``save_tiff`(filename, width, region=None, supersample=None, convert_to_256_colors=None, gray_scale_depth=None, byte_order=None)

  Save a TIFF image.

  Parameters: | filename (`string`) – filename with or without extension. 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. 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 2-16. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. A large intermediate image is rendered and then reduced to the final image size. Each pixel on the final image is created from multiple rendered pixels. The width and height of the intermediate image are the width and height of the final image times some scale factor. This scale factor is the Supersample Factor. You can use values from 2 to 16. Factors greater than 3 are seldom necessary. Large scale factors take a lot more time and memory. Some graphics cards limit the dimensions of rendered images to a maximum of 2048x2048 or 4096x4096 pixels, and thus Tecplot cannot antialias if the intermediate image would be larger than this limit. Antialiasing uses many colors. Antialiasing with 256 colors wastes time and may decrease plot quality. (default: `None`) 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: `None`) 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

  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:

      >>> import tecplot
      >>> 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_jpeg()

`tecplot.export.``save_jpeg`(filename, width, region=None, supersample=None, encoding=None, quality=None)

  Save a JPEG image.

  Parameters: | filename (`string`) – filename with or without extension. 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. 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 2-16. Antialiasing smooths jagged edges on text, lines, and edges of image output formats by the process of supersampling. A large intermediate image is rendered and then reduced to the final image size. Each pixel on the final image is created from multiple rendered pixels. The width and height of the intermediate image are the width and height of the final image times some scale factor. This scale factor is the Supersample Factor. You can use values from 2 to 16. Factors greater than 3 are seldom necessary. Large scale factors take a lot more time and memory. Some graphics cards limit the dimensions of rendered images to a maximum of 2048x2048 or 4096x4096 pixels, and thus Tecplot cannot antialias if the intermediate image would be larger than this limit. Antialiasing uses many colors. Antialiasing with 256 colors wastes time and may decrease plot quality. (default: `None`) 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. Encoding 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

  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:

      >>> import tecplot
      >>> frame = tecplot.active_page().add_frame()
      >>> tecplot.load_layout('mylayout.lay')
      >>> tecplot.export.save_jpeg('image.jpeg', width=600, supersample=2,
      >>>                         region=frame,
      >>>                         quality=50)

### Navigation

- index
- modules |
- next |
- previous |