Saving Image files

Skip to end of metadata
Go to start of metadata
This page is no longer maintained. For an updated page, please visit http://www.aspose.com/docs/display/imagingjava/Drawing+and+Formatting+Images
Aspose.Imaging lets you create image files from scratch. It also provides the means to edit existing image files. Once the image is created or modified, the file is usually saved to disk.

Aspose.Imaging provides you with methods for saving images to a disk by specifying a path or using a Stream object.

If the image is created by specifying any of the ImageOptions in the Image.create static method, the image is automatically saved to the path or stream supplied during the initialization of the Image class.

Saving to Disk

The Image class represents an image object, so this class provides all the tools needed to create, load and save an image file. Use the Image class' Save method to save images. One overloaded version of the Save method accepts the file location as a string. Below is an example of how this can be used.

Programming Sample

Java
//Use the Save method exposed by the Image Class to save the image
image.save("C:\\output.bmp");
 

Saving to a Stream

Another overloaded version of the Save method accepts the Stream object as an argument and saves the image file to the stream.

Programming Sample

Java
//Create an instance of FileOutputStream
java.io.OutputStream os = new java.io.FileOutputStream("C:\\output.bmp");

//Save the image using the Save method exposed by the Image class and pass the outputstream object
image.save(os);
 
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.