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

Possibility to set DPI for PNG

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.97, 1.0-alpha1, 1.1, 1.x
    • 1.0-alpha1
    • Format: PNG
    • None
    • Any

    Description

      How I can to set DPI for PNG image?

      File inImgFile = new File("in.png");
      File outImgFile = new File("out.png");
      BufferedImage image = Sanselan.getBufferedImage(inImgFile);
      // ImageInfo imageinfo = Sanselan.getImageInfo(inImgFile);
      // imageinfo.getPhysicalHeightDpi(): returned 300
      // imageinfo.getPhysicalWidthDpi(): returned 300
      // Sanselan.getMetadata(inImgFile): returned null
      
      ImageFormat format = ImageFormat.IMAGE_FORMAT_PNG;
      Sanselan.writeImage(image, outImgFile, format, params);
      // imageinfo = Sanselan.getImageInfo(outImgFile);
      // imageinfo.getPhysicalHeightDpi(): returned -1
      // imageinfo.getPhysicalWidthDpi(): returned -1
      

      Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vvd VVD
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: