private void saveMemoryBlockJPG(ImageData imageData,File file,float quality) throws Exception {
  BufferedImage bufferedImage=getBufferedImageFromData(imageData);
  Iterator iter=ImageIO.getImageWritersByFormatName("jpg");
  ImageWriter writer=(ImageWriter)iter.next();
  ImageWriteParam iwp=writer.getDefaultWriteParam();
  iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
  iwp.setCompressionQuality(quality);
  FileImageOutputStream output=null;
  try {
    output=new FileImageOutputStream(file);
    writer.setOutput(output);
    IIOImage image=new IIOImage(bufferedImage,null,null);
    writer.write(null,image,iwp);
    addScanFile(file);
  }
 catch (  Exception e) {
    throw e;
  }
 finally {
    if (output != null) {
      output.close();
    }
  }
}

private void saveMemoryBlockJPG ( ImageData imageData , File file , float quality ) throws Exception { BufferedImage bufferedImage = getBufferedImageFromData ( imageData ) ; Iterator iter = ImageIO . getImageWritersByFormatName ( "jpg" ) ; ImageWriter writer = ( ImageWriter ) iter . next ( ) ; ImageWriteParam iwp = writer . getDefaultWriteParam ( ) ; iwp . setCompressionMode ( ImageWriteParam . MODE_EXPLICIT ) ; iwp . setCompressionQuality ( quality ) ; FileImageOutputStream output = null ; try { output = new FileImageOutputStream ( file ) ; writer . setOutput ( output ) ; IIOImage image = new IIOImage ( bufferedImage , null , null ) ; writer . write ( null , image , iwp ) ; addScanFile ( file ) ; } catch ( Exception e ) { throw e ; } finally { if ( output != null ) { output . close ( ) ; } } }
salva la informacion de la imagen en un fichero jpg con la calidad indicada
