FileOutputStream out = new FileOutputStream(imageFile);
FilteredImageSource fis =
new FilteredImageSource(image.getSource(),
new TransFilter(TRANSPARENT_BG_COLOR));
GifEncoder ge = new GifEncoder(fis, out);
ge.encode();
out.flush();
out.close();
} else if (imageType.equalsIgnoreCase("svg")) {
FileOutputStream out = new FileOutputStream(imageFile);
boolean useCSS = true; // we want to use CSS style attribute