loci.formats.gui

## Class BufferedImageWriter

- java.lang.Object
- - loci.formats.WriterWrapper
  - - loci.formats.gui.BufferedImageWriter

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

      public class BufferedImageWriter
      extends WriterWrapper

  A writer wrapper for writing image planes from BufferedImage objects.

- - ### Field Summary

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

      `writer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferedImageWriter()` Constructs a BufferedImageWriter around a new image writer.
    `BufferedImageWriter(IFormatWriter r)` Constructs a BufferedImageWriter with the given writer.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BufferedImageWriter` | `makeBufferedImageWriter(IFormatWriter w)` Converts the given writer into a BufferedImageWriter, wrapping if needed.
    `void` | `saveImage(int no, java.awt.image.BufferedImage image)` Saves the given BufferedImage to the current file.
    `void` | `saveImage(int no, java.awt.image.BufferedImage image, int x, int y, int w, int h)` Saves the given BufferedImage to the current file.
    `static byte[]` | `toBytes(java.awt.image.BufferedImage image, IFormatWriter writer)`

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

      `canDoStacks, changeOutputFile, close, duplicate, getCodec, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFormat, getFramesPerSecond, getMetadataOptions, getMetadataRetrieve, getNativeDataType, getPixelTypes, getPixelTypes, getResolution, getResolutionCount, getResolutions, getSeries, getSuffixes, getSupportedMetadataLevels, getTileSizeX, getTileSizeY, getWriter, isInterleaved, isSupportedType, isThisType, saveBytes, saveBytes, saveBytes, saveCompressedBytes, savePlane, savePlane, savePlane, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setId, setInterleaved, setMetadataOptions, setMetadataRetrieve, setResolution, setResolutions, setSeries, setTileSizeX, setTileSizeY, setValidBitsPerPixel, setWriteSequentially, unwrap, unwrap, unwrap`

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

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

- - ### Constructor Detail

    - #### BufferedImageWriter

          public BufferedImageWriter()

      Constructs a BufferedImageWriter around a new image writer.

    - #### BufferedImageWriter

          public BufferedImageWriter(IFormatWriter r)

      Constructs a BufferedImageWriter with the given writer.

  - ### Method Detail

    - #### makeBufferedImageWriter

          public static BufferedImageWriter makeBufferedImageWriter(IFormatWriter w)

      Converts the given writer into a BufferedImageWriter, wrapping if needed.

    - #### saveImage

          public void saveImage(int no,
                                java.awt.image.BufferedImage image)
                         throws FormatException,
                                java.io.IOException

      Saves the given BufferedImage to the current file.
      Parameters:
        `no` - the plane index within the series.
        `image` - the BufferedImage to save.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### saveImage

          public void saveImage(int no,
                                java.awt.image.BufferedImage image,
                                int x,
                                int y,
                                int w,
                                int h)
                         throws FormatException,
                                java.io.IOException

      Saves the given BufferedImage to the current file. The BufferedImage may represent a subsection of the full image to be saved.
      Parameters:
        `no` - the plane index within the series.
        `image` - the BufferedImage to save.
        `x` - the X coordinate of the upper-left corner of the image.
        `y` - the Y coordinate of the upper-left corner of the image.
        `w` - the width (in pixels) of the image.
        `h` - the height (in pixels) of the image.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### toBytes

          public static byte[] toBytes(java.awt.image.BufferedImage image,
                                       IFormatWriter writer)

Copyright © 2026 Open Microscopy Environment