ij.io
Class FileSaver

java.lang.Object
  extended by ij.io.FileSaver

public class FileSaver
extends java.lang.Object

Saves images in tiff, gif, jpeg, raw, zip and text format.


Field Summary
static int DEFAULT_JPEG_QUALITY
           
 
Constructor Summary
FileSaver(ImagePlus imp)
          Constructs a FileSaver from an ImagePlus.
 
Method Summary
 java.lang.String getDescriptionString()
          Returns a string containing information about the specified image.
static int getJpegQuality()
          Returns the current JPEG quality setting (0-100).
static boolean okForFits(ImagePlus imp)
           
static boolean okForGif(ImagePlus imp)
           
static boolean okForJpeg(ImagePlus imp)
          Always returns true.
 boolean save()
          Resaves the image.
 boolean saveAsBmp()
          Save the image in BMP format using a save file dialog.
 boolean saveAsBmp(java.lang.String path)
          Save the image in BMP format using the specified path.
 boolean saveAsFits()
          Save the image in FITS format using a save file dialog.
 boolean saveAsFits(java.lang.String path)
          Save the image in FITS format using the specified path.
 boolean saveAsGif()
          Save the image in GIF format using a save file dialog.
 boolean saveAsGif(java.lang.String path)
          Save the image in Gif format using the specified path.
 boolean saveAsJpeg()
          Save the image in JPEG format using a save file dialog.
 boolean saveAsJpeg(java.lang.String path)
          Save the image in JPEG format using the specified path.
 boolean saveAsLut()
          Save the current LUT using a save file dialog.
 boolean saveAsLut(java.lang.String path)
          Save the current LUT using the specified path.
 boolean saveAsPgm()
          Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using a save file dialog.
 boolean saveAsPgm(java.lang.String path)
          Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using the specified path.
 boolean saveAsPng()
          Save the image in PNG format using a save file dialog.
 boolean saveAsPng(java.lang.String path)
          Save the image in PNG format using the specified path.
 boolean saveAsRaw()
          Save the image or stack as raw data using a save file dialog.
 boolean saveAsRaw(java.lang.String path)
          Save the image as raw data using the specified path.
 boolean saveAsRawStack(java.lang.String path)
          Save the stack as raw data using the specified path.
 boolean saveAsText()
          Save the image as tab-delimited text using a save file dialog.
 boolean saveAsText(java.lang.String path)
          Save the image as tab-delimited text using the specified path.
 boolean saveAsTiff()
          Save the image or stack in TIFF format using a save file dialog.
 boolean saveAsTiff(java.lang.String path)
          Save the image in TIFF format using the specified path.
 boolean saveAsTiffStack(java.lang.String path)
          Save the stack as a multi-image TIFF using the specified path.
 boolean saveAsZip()
          Uses a save file dialog to save the image or stack as a TIFF in a ZIP archive.
 boolean saveAsZip(java.lang.String path)
          Save the image or stack in TIFF/ZIP format using the specified path.
static void setJpegQuality(int quality)
          Specifies the image quality (0-100).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JPEG_QUALITY

public static final int DEFAULT_JPEG_QUALITY
See Also:
Constant Field Values
Constructor Detail

FileSaver

public FileSaver(ImagePlus imp)
Constructs a FileSaver from an ImagePlus.

Method Detail

save

public boolean save()
Resaves the image. Calls saveAsTiff() if this is a new image, not a TIFF, or if the image was loaded using a URL. Returns false if saveAsTiff() is called and the user selects cancel in the file save dialog box.


saveAsTiff

public boolean saveAsTiff()
Save the image or stack in TIFF format using a save file dialog. Returns false if the user selects cancel.


saveAsTiff

public boolean saveAsTiff(java.lang.String path)
Save the image in TIFF format using the specified path.


saveAsTiffStack

public boolean saveAsTiffStack(java.lang.String path)
Save the stack as a multi-image TIFF using the specified path.


saveAsZip

public boolean saveAsZip()
Uses a save file dialog to save the image or stack as a TIFF in a ZIP archive. Returns false if the user selects cancel.


saveAsZip

public boolean saveAsZip(java.lang.String path)
Save the image or stack in TIFF/ZIP format using the specified path.


okForGif

public static boolean okForGif(ImagePlus imp)

saveAsGif

public boolean saveAsGif()
Save the image in GIF format using a save file dialog. Returns false if the user selects cancel or the image is not 8-bits.


saveAsGif

public boolean saveAsGif(java.lang.String path)
Save the image in Gif format using the specified path. Returns false if the image is not 8-bits or there is an I/O error.


okForJpeg

public static boolean okForJpeg(ImagePlus imp)
Always returns true.


saveAsJpeg

public boolean saveAsJpeg()
Save the image in JPEG format using a save file dialog. Returns false if the user selects cancel.

See Also:
setJpegQuality, getJpegQuality

saveAsJpeg

public boolean saveAsJpeg(java.lang.String path)
Save the image in JPEG format using the specified path.

See Also:
setJpegQuality, getJpegQuality

saveAsBmp

public boolean saveAsBmp()
Save the image in BMP format using a save file dialog. Returns false if the user selects cancel.


saveAsBmp

public boolean saveAsBmp(java.lang.String path)
Save the image in BMP format using the specified path.


saveAsPgm

public boolean saveAsPgm()
Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using a save file dialog. Returns false if the user selects cancel.


saveAsPgm

public boolean saveAsPgm(java.lang.String path)
Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using the specified path.


saveAsPng

public boolean saveAsPng()
Save the image in PNG format using a save file dialog. Returns false if the user selects cancel.


saveAsPng

public boolean saveAsPng(java.lang.String path)
Save the image in PNG format using the specified path.


saveAsFits

public boolean saveAsFits()
Save the image in FITS format using a save file dialog. Returns false if the user selects cancel.


saveAsFits

public boolean saveAsFits(java.lang.String path)
Save the image in FITS format using the specified path.


okForFits

public static boolean okForFits(ImagePlus imp)

saveAsRaw

public boolean saveAsRaw()
Save the image or stack as raw data using a save file dialog. Returns false if the user selects cancel.


saveAsRaw

public boolean saveAsRaw(java.lang.String path)
Save the image as raw data using the specified path.


saveAsRawStack

public boolean saveAsRawStack(java.lang.String path)
Save the stack as raw data using the specified path.


saveAsText

public boolean saveAsText()
Save the image as tab-delimited text using a save file dialog. Returns false if the user selects cancel.


saveAsText

public boolean saveAsText(java.lang.String path)
Save the image as tab-delimited text using the specified path.


saveAsLut

public boolean saveAsLut()
Save the current LUT using a save file dialog. Returns false if the user selects cancel.


saveAsLut

public boolean saveAsLut(java.lang.String path)
Save the current LUT using the specified path.


getDescriptionString

public java.lang.String getDescriptionString()
Returns a string containing information about the specified image.


setJpegQuality

public static void setJpegQuality(int quality)
Specifies the image quality (0-100). 0 is poorest image quality, highest compression, and 100 is best image quality, lowest compression.


getJpegQuality

public static int getJpegQuality()
Returns the current JPEG quality setting (0-100).