Class BufferedImageWriter

java.lang.Object
loci.formats.WriterWrapper
loci.formats.gui.BufferedImageWriter
All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler

public class BufferedImageWriter extends WriterWrapper
A writer wrapper for writing image planes from BufferedImage objects.
  • Constructor Details

    • BufferedImageWriter

      public BufferedImageWriter()
      Constructs a BufferedImageWriter around a new image writer.
    • BufferedImageWriter

      public BufferedImageWriter(IFormatWriter r)
      Constructs a BufferedImageWriter with the given writer.
  • Method Details

    • makeBufferedImageWriter

      public static BufferedImageWriter makeBufferedImageWriter(IFormatWriter w)
      Converts the given writer into a BufferedImageWriter, wrapping if needed.
    • saveImage

      public void saveImage(int no, BufferedImage image) throws FormatException, IOException
      Saves the given BufferedImage to the current file.
      Parameters:
      no - the plane index within the series.
      image - the BufferedImage to save.
      Throws:
      FormatException
      IOException
    • saveImage

      public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) throws FormatException, 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
      IOException
    • toBytes

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