incubator-sanselan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk Daems" <dirk.da...@gmail.com>
Subject transform png to gif
Date Tue, 15 Jul 2008 15:53:55 GMT
Hi,
I want to transform a set of PNG images to GIF images.

The code I tried:

private static void convertImage(String sourceDir, String sourceFile, String
targetDir){

  try{

   BufferedImage source = Sanselan.getBufferedImage(new File(sourceDir +
File.separator + sourceFile));
   String targetFile = sourceFile.substring(0, sourceFile.indexOf('.')) +
".gif";
   Hashtable parms = new Hashtable();
   // parms.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
   Sanselan.writeImage(source, new File(targetDir + File.separator +
targetFile), ImageFormat.IMAGE_FORMAT_GIF, parms);

  }
  catch(Exception ex){
   ex.printStackTrace();
  }

 }

I don't get any errors but the image that's generated cannot be displayed
and is way too small (2kb). What could I be doing wrong?

Thanks in advance!

Kind regards,
Dirk Daems

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message