FileOutputStream newimage = null;
InputStream fis = orig_img;
try {
if ("gif".equalsIgnoreCase(extendName)) {
GifImage gifImage = GifDecoder.decode(fis);
fis.close(); fis = null;
GifImage newGif = GifTransformer.resize(gifImage, p_width,p_height, false);
newimage = new FileOutputStream(obj_filename);
GifEncoder.encode(newGif, newimage);
} else {
BufferedImage orig_portrait = (BufferedImage) ImageIO.read(fis);
fis.close(); fis = null;