BufferedImage image_4 = Sanselan.getBufferedImage(is);
// <b>Write an image. </b>
BufferedImage image = someImage;
File dst = someFile;
ImageFormat format = ImageFormat.IMAGE_FORMAT_PNG;
Map optional_params = new HashMap();
Sanselan.writeImage(image, dst, format, optional_params);
OutputStream os = someOutputStream;
Sanselan.writeImage(image, os, format, optional_params);
// <b>get the image's embedded ICC Profile, if it has one. </b>
byte iccProfileBytes[] = Sanselan.getICCProfileBytes(imageBytes);
ICC_Profile iccProfile = Sanselan.getICCProfile(imageBytes);
// <b>get the image's width and height. </b>
Dimension d = Sanselan.getImageSize(imageBytes);
// <b>get all of the image's info (ie. bits per pixel, size, transparency, etc.) </b>
ImageInfo imageInfo = Sanselan.getImageInfo(imageBytes);
if (imageInfo.getColorType() == ImageInfo.COLOR_TYPE_GRAYSCALE)
System.out.println("Grayscale image.");
if (imageInfo.getHeight() > 1000)
System.out.println("Large image.");
// <b>try to guess the image's format. </b>
ImageFormat image_format = Sanselan.guessFormat(imageBytes);
image_format.equals(ImageFormat.IMAGE_FORMAT_PNG);
// <b>get all metadata stored in EXIF format (ie. from JPEG or TIFF). </b>
// <b>org.w3c.dom.Node node = Sanselan.getMetadataObsolete(imageBytes); </b>
IImageMetadata metdata = Sanselan.getMetadata(imageBytes);