ImageTranscoder imageTranscoder = new JPEGTranscoder();
imageTranscoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));
TranscoderInput input = new TranscoderInput(new StringReader(inputstr));
FileOutputStream ostream = new FileOutputStream(new File(dir.listFiles()[k].getAbsolutePath().substring(0,dir.listFiles()[k].getAbsolutePath().length()-4)+".png"));
TranscoderOutput output = new TranscoderOutput(ostream);
imageTranscoder.transcode(input, output);
ostream.flush();
ostream.close();
}
}
}