- java.lang.Object
- 
- ij.io.FileSaver
 
- 
 public class FileSaver extends java.lang.ObjectSaves images in tiff, gif, jpeg, raw, zip and text format.
- 
- 
Field SummaryFields Modifier and Type Field Description static intDEFAULT_JPEG_QUALITY
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescriptionString()Returns a string containing information about the specified image.static intgetJpegQuality()Returns the current JPEG quality setting (0-100).static byte[][]getOverlay(ImagePlus imp)static booleanokForFits(ImagePlus imp)static booleanokForGif(ImagePlus imp)static booleanokForJpeg(ImagePlus imp)Always returns true.booleansave()Resaves the image.booleansaveAsBmp()Save the image in BMP format using a save file dialog.booleansaveAsBmp(java.lang.String path)Save the image in BMP format using the specified path.booleansaveAsFits()Save the image in FITS format using a save file dialog.booleansaveAsFits(java.lang.String path)Save the image in FITS format using the specified path.booleansaveAsGif()Save the image in GIF format using a save file dialog.booleansaveAsGif(java.lang.String path)Save the image in Gif format using the specified path.booleansaveAsJpeg()Save the image in JPEG format using a save file dialog.booleansaveAsJpeg(java.lang.String path)Save the image in JPEG format using the specified path.booleansaveAsLut()Save the current LUT using a save file dialog.booleansaveAsLut(java.lang.String path)Save the current LUT using the specified path.booleansaveAsPgm()Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using a save file dialog.booleansaveAsPgm(java.lang.String path)Saves grayscale images in PGM (portable graymap) format and RGB images in PPM (portable pixmap) format, using the specified path.booleansaveAsPng()Save the image in PNG format using a save file dialog.booleansaveAsPng(java.lang.String path)Save the image in PNG format using the specified path.booleansaveAsRaw()Save the image or stack as raw data using a save file dialog.booleansaveAsRaw(java.lang.String path)Save the image as raw data using the specified path.booleansaveAsRawStack(java.lang.String path)Save the stack as raw data using the specified path.booleansaveAsText()Save the image as tab-delimited text using a save file dialog.booleansaveAsText(java.lang.String path)Save the image as tab-delimited text using the specified path.booleansaveAsTiff()Saves the image or stack in TIFF format using a save file dialog.booleansaveAsTiff(java.lang.String path)Saves the image in TIFF format using the specified path.booleansaveAsTiffStack(java.lang.String path)Saves the stack as a multi-image TIFF using the specified path.booleansaveAsZip()Uses a save file dialog to save the image or stack as a TIFF in a ZIP archive.booleansaveAsZip(java.lang.String path)Save the image or stack in TIFF/ZIP format using the specified path.voidsaveDisplayRangesAndLuts(ImagePlus imp, FileInfo fi)byte[]serialize()Converts this image to a TIFF encoded array of bytes, which can be decoded using Opener.deserialize().static voidsetBufferSize(int bufferSize)Sets the BufferedOutputStream buffer size in bytes (default is 32K).static voidsetJpegQuality(int quality)Specifies the image quality (0-100).voidupdateImagePlus(java.lang.String path, int fileFormat)
 
- 
- 
- 
Field Detail- 
DEFAULT_JPEG_QUALITYpublic static final int DEFAULT_JPEG_QUALITY - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
FileSaverpublic FileSaver(ImagePlus imp) Constructs a FileSaver from an ImagePlus.
 
- 
 - 
Method Detail- 
savepublic 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.
 - 
saveAsTiffpublic boolean saveAsTiff() Saves the image or stack in TIFF format using a save file dialog. Returns false if the user selects cancel. Equivalent to IJ.saveAsTiff(imp,""), which is more convenient.
 - 
saveAsTiffpublic boolean saveAsTiff(java.lang.String path) Saves the image in TIFF format using the specified path. Equivalent to IJ.saveAsTiff(imp,path), which is more convenient.
 - 
getOverlaypublic static byte[][] getOverlay(ImagePlus imp) 
 - 
saveAsTiffStackpublic boolean saveAsTiffStack(java.lang.String path) Saves the stack as a multi-image TIFF using the specified path. Equivalent to IJ.saveAsTiff(imp,path), which is more convenient.
 - 
serializepublic byte[] serialize() Converts this image to a TIFF encoded array of bytes, which can be decoded using Opener.deserialize().
 - 
saveAsZippublic 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.
 - 
saveAsZippublic boolean saveAsZip(java.lang.String path) Save the image or stack in TIFF/ZIP format using the specified path.
 - 
okForGifpublic static boolean okForGif(ImagePlus imp) 
 - 
saveAsGifpublic 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.
 - 
saveAsGifpublic 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.
 - 
okForJpegpublic static boolean okForJpeg(ImagePlus imp) Always returns true.
 - 
saveAsJpegpublic boolean saveAsJpeg() Save the image in JPEG format using a save file dialog. Returns false if the user selects cancel.- See Also:
- setJpegQuality(int),- getJpegQuality()
 
 - 
saveAsJpegpublic boolean saveAsJpeg(java.lang.String path) Save the image in JPEG format using the specified path.- See Also:
- setJpegQuality(int),- getJpegQuality()
 
 - 
saveAsBmppublic boolean saveAsBmp() Save the image in BMP format using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsBmppublic boolean saveAsBmp(java.lang.String path) Save the image in BMP format using the specified path.
 - 
saveAsPgmpublic 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.
 - 
saveAsPgmpublic 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.
 - 
saveAsPngpublic boolean saveAsPng() Save the image in PNG format using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsPngpublic boolean saveAsPng(java.lang.String path) Save the image in PNG format using the specified path.
 - 
saveAsFitspublic boolean saveAsFits() Save the image in FITS format using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsFitspublic boolean saveAsFits(java.lang.String path) Save the image in FITS format using the specified path.
 - 
okForFitspublic static boolean okForFits(ImagePlus imp) 
 - 
saveAsRawpublic boolean saveAsRaw() Save the image or stack as raw data using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsRawpublic boolean saveAsRaw(java.lang.String path) Save the image as raw data using the specified path.
 - 
saveAsRawStackpublic boolean saveAsRawStack(java.lang.String path) Save the stack as raw data using the specified path.
 - 
saveAsTextpublic boolean saveAsText() Save the image as tab-delimited text using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsTextpublic boolean saveAsText(java.lang.String path) Save the image as tab-delimited text using the specified path.
 - 
saveAsLutpublic boolean saveAsLut() Save the current LUT using a save file dialog. Returns false if the user selects cancel.
 - 
saveAsLutpublic boolean saveAsLut(java.lang.String path) Save the current LUT using the specified path.
 - 
updateImagePluspublic void updateImagePlus(java.lang.String path, int fileFormat)
 - 
getDescriptionStringpublic java.lang.String getDescriptionString() Returns a string containing information about the specified image.
 - 
setJpegQualitypublic 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.
 - 
getJpegQualitypublic static int getJpegQuality() Returns the current JPEG quality setting (0-100).
 - 
setBufferSizepublic static void setBufferSize(int bufferSize) Sets the BufferedOutputStream buffer size in bytes (default is 32K).
 
- 
 
-