Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-32

Can't convert PNG image to GIF image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • None
    • 0.97
    • None
    • None
    • Windows XP SP2, Eclipse IDE, Custom Java database conversion program, JRE 1.5.x

    Description

      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).

      I attached an example of a PNG file I can't seem to convert.

      Attachments

        1. 12118.png
          546 kB
          Dirk Daems

        Activity

          People

            Unassigned Unassigned
            dirkd Dirk Daems
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: