loci.formats.out

## Class AVIWriter

- java.lang.Object
- - loci.formats.FormatHandler
  - - loci.formats.FormatWriter
    - - loci.formats.out.AVIWriter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler

      public class AVIWriter
      extends FormatWriter

  AVIWriter is the file format writer for AVI files. Much of this writer's code was adapted from Wayne Rasband's AVI Movie Writer plugin for ImageJ (available at http://rsb.info.nih.gov/ij/).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `bytesPerPixel`
    `private static java.lang.String` | `DATA_SIGNATURE`
    `private long` | `endPos`
    `private static long` | `FRAME_OFFSET`
    `private static long` | `FRAME_OFFSET_2`
    `private long` | `idx1Pos`
    `private int` | `microSecPerFrame`
    `private static long` | `PADDING_BYTES`
    `private int` | `planesWritten`
    `private static long` | `SAVE_FILE_SIZE`
    `private static long` | `SAVE_JUNK_SIG`
    `private static long` | `SAVE_LIST1_SIZE`
    `private static long` | `SAVE_LIST1_SUBSIZE`
    `private static long` | `SAVE_LIST2_SIZE`
    `private static long` | `SAVE_MOVI`
    `private static long` | `SAVE_STRF_SIZE`
    `private static long` | `SAVE_STRN_POS`
    `private java.util.List<java.lang.Long>` | `savedbLength`
    `private long` | `saveidx1Length`
    `private int` | `tDim`
    `private int` | `xDim`
    `private int` | `xPad`
    `private int` | `yDim`
    `private int` | `zDim`

    - ### Fields inherited from class loci.formats.FormatWriter

      `cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBits`

    - ### Fields inherited from class loci.formats.FormatHandler

      `COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AVIWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canDoStacks()` Reports whether the writer can save multiple images to a single file.
    `void` | `close()`
    `int[]` | `getPixelTypes(java.lang.String codec)` Gets the supported pixel types for the given codec.
    `void` | `saveBytes(int no, byte[] buf, int x, int y, int w, int h)` Saves the given image tile to the current series in the current file.
    `void` | `setId(java.lang.String id)` Initializes a writer from the input file name.

    - ### Methods inherited from class loci.formats.FormatWriter

      `changeOutputFile, checkParams, createOutputStream, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFramesPerSecond, getMetadataRetrieve, getPixelTypes, getPlaneCount, getPlaneCount, getResolution, getResolutionCount, getResolutions, getSamplesPerPixel, getSamplesPerPixel, getSeries, getSizeX, getSizeY, getTileSizeX, getTileSizeY, hasResolutions, isFullPlane, isInterleaved, isSupportedType, saveBytes, saveBytes, savePlane, savePlane, savePlane, seekToPlaneOffset, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setInterleaved, setMetadataRetrieve, setResolution, setResolutions, setSeries, setTileSizeX, setTileSizeY, setValidBitsPerPixel, setWriteSequentially`

    - ### Methods inherited from class loci.formats.FormatHandler

      `checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptions`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface loci.formats.IFormatHandler

      `getFormat, getNativeDataType, getSuffixes, isThisType`

    - ### Methods inherited from interface loci.formats.IMetadataConfigurable

      `getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions`

    - ### Methods inherited from interface loci.formats.ICompressedTileWriter

      `getCodec, saveCompressedBytes`

- - ### Field Detail

    - #### SAVE_MOVI

          private static final long SAVE_MOVI

      See Also:
        Constant Field Values

    - #### SAVE_FILE_SIZE

          private static final long SAVE_FILE_SIZE

      See Also:
        Constant Field Values

    - #### SAVE_STRF_SIZE

          private static final long SAVE_STRF_SIZE

      See Also:
        Constant Field Values

    - #### SAVE_STRN_POS

          private static final long SAVE_STRN_POS

      See Also:
        Constant Field Values

    - #### SAVE_JUNK_SIG

          private static final long SAVE_JUNK_SIG

      See Also:
        Constant Field Values

    - #### SAVE_LIST1_SIZE

          private static final long SAVE_LIST1_SIZE

      See Also:
        Constant Field Values

    - #### SAVE_LIST1_SUBSIZE

          private static final long SAVE_LIST1_SUBSIZE

      See Also:
        Constant Field Values

    - #### FRAME_OFFSET

          private static final long FRAME_OFFSET

      See Also:
        Constant Field Values

    - #### FRAME_OFFSET_2

          private static final long FRAME_OFFSET_2

      See Also:
        Constant Field Values

    - #### PADDING_BYTES

          private static final long PADDING_BYTES

      See Also:
        Constant Field Values

    - #### SAVE_LIST2_SIZE

          private static final long SAVE_LIST2_SIZE

      See Also:
        Constant Field Values

    - #### DATA_SIGNATURE

          private static final java.lang.String DATA_SIGNATURE

      See Also:
        Constant Field Values

    - #### planesWritten

          private int planesWritten

    - #### bytesPerPixel

          private int bytesPerPixel

    - #### xDim

          private int xDim

    - #### yDim

          private int yDim

    - #### zDim

          private int zDim

    - #### tDim

          private int tDim

    - #### xPad

          private int xPad

    - #### microSecPerFrame

          private int microSecPerFrame

    - #### savedbLength

          private java.util.List<java.lang.Long> savedbLength

    - #### idx1Pos

          private long idx1Pos

    - #### endPos

          private long endPos

    - #### saveidx1Length

          private long saveidx1Length

  - ### Constructor Detail

    - #### AVIWriter

          public AVIWriter()

  - ### Method Detail

    - #### saveBytes

          public void saveBytes(int no,
                                byte[] buf,
                                int x,
                                int y,
                                int w,
                                int h)
                         throws FormatException,
                                java.io.IOException

      Description copied from interface: `IFormatWriter`
      Saves the given image tile to the current series in the current file.
      Parameters:
        `no` - the plane index within the series.
        `buf` - the byte array that represents the image tile.
        `x` - the X coordinate of the upper-left corner of the image tile.
        `y` - the Y coordinate of the upper-left corner of the image tile.
        `w` - the width (in pixels) of the image tile.
        `h` - the height (in pixels) of the image tile.
      Throws:
        `FormatException` - if one of the parameters is invalid.
        `java.io.IOException` - if there was a problem writing to the file.
      See Also:
        `IFormatWriter.saveBytes(int, byte[], int, int, int, int)`

    - #### canDoStacks

          public boolean canDoStacks()

      Description copied from interface: `IFormatWriter`
      Reports whether the writer can save multiple images to a single file.
      Specified by:
        `canDoStacks` in interface `IFormatWriter`
      Overrides:
        `canDoStacks` in class `FormatWriter`

    - #### getPixelTypes

          public int[] getPixelTypes(java.lang.String codec)

      Description copied from interface: `IFormatWriter`
      Gets the supported pixel types for the given codec.
      Specified by:
        `getPixelTypes` in interface `IFormatWriter`
      Overrides:
        `getPixelTypes` in class `FormatWriter`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `FormatWriter`
      Throws:
        `java.io.IOException`

    - #### setId

          public void setId(java.lang.String id)
                     throws FormatException,
                            java.io.IOException

      Description copied from class: `FormatWriter`
      Initializes a writer from the input file name. Initializes a `RandomAccessOutputStream` for the output file and initializes the metadata for all the series using `FormatWriter.setSeries(int)`.
      Specified by:
        `setId` in interface `IFormatHandler`
      Overrides:
        `setId` in class `FormatWriter`
      Parameters:
        `id` - a `String` specifying the path to the file
      Throws:
        `FormatException`
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment