You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "VVD (Created) (JIRA)" <ji...@apache.org> on 2012/03/06 17:12:58 UTC

[jira] [Created] (SANSELAN-67) Possibility to set DPI for PNG

Possibility to set DPI for PNG
------------------------------

                 Key: SANSELAN-67
                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
             Project: Commons Sanselan
          Issue Type: Question
          Components: Format: PNG
    Affects Versions: 0.97
         Environment: Any
            Reporter: VVD


How I can to set DPI for PNG image?

{code}
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
{code}

Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "VVD (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

VVD updated SANSELAN-67:
------------------------

    Affects Version/s: 1.x
                       1.1
                       1.0
    
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Improvement
>          Components: Format: PNG
>    Affects Versions: 0.97, 1.0, 1.1, 1.x
>         Environment: Any
>            Reporter: VVD
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "VVD (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223917#comment-13223917 ] 

VVD commented on SANSELAN-67:
-----------------------------

Yes, it is.

Do you add this before 1.0 release?
                
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Question
>          Components: Format: PNG
>    Affects Versions: 0.97
>         Environment: Any
>            Reporter: VVD
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "VVD (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

VVD updated SANSELAN-67:
------------------------

    Issue Type: Improvement  (was: Question)
    
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Improvement
>          Components: Format: PNG
>    Affects Versions: 0.97
>         Environment: Any
>            Reporter: VVD
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "Damjan Jovanovic (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13231902#comment-13231902 ] 

Damjan Jovanovic commented on SANSELAN-67:
------------------------------------------

This should work in 1.0, with BMP, PCX, PNG, and TIFF:

{code}
Map params = new HashMap();
params.put(SanselanConstants.PARAM_KEY_PIXEL_DENSITY, PixelDensity.createFromPixelsPerCentimetre(300, 300));
Sanselan.writeImage(image, outImgFile, format, params);
{code}

                
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Improvement
>          Components: Format: PNG
>    Affects Versions: 0.97, 1.0, 1.1, 1.x
>         Environment: Any
>            Reporter: VVD
>             Fix For: 1.0
>
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "Damjan Jovanovic (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223457#comment-13223457 ] 

Damjan Jovanovic commented on SANSELAN-67:
------------------------------------------

You are meant to set DPI using parameters passed to Sanselan.writeImage(), as shown in the example below:

{code}
Map params = new HashMap();
params.put(SanselanConstants.PARAM_KEY_X_RESOLUTION, Integer.ValueOf(300));
params.put(SanselanConstants.PARAM_KEY_Y_RESOLUTION, Integer.ValueOf(300));
Sanselan.writeImage(image, outImgFile, format, params);
{code}

But this only works when writing BMP and TIFF images at the moment. I'll have to add it to other formats like PNG as well.

                
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Question
>          Components: Format: PNG
>    Affects Versions: 0.97
>         Environment: Any
>            Reporter: VVD
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SANSELAN-67) Possibility to set DPI for PNG

Posted by "Damjan Jovanovic (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Damjan Jovanovic resolved SANSELAN-67.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0

Fixed by commit 1301892, resolving fixed.

                
> Possibility to set DPI for PNG
> ------------------------------
>
>                 Key: SANSELAN-67
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-67
>             Project: Commons Sanselan
>          Issue Type: Improvement
>          Components: Format: PNG
>    Affects Versions: 0.97, 1.0, 1.1, 1.x
>         Environment: Any
>            Reporter: VVD
>             Fix For: 1.0
>
>
> How I can to set DPI for PNG image?
> {code}
> 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
> {code}
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira