[ 
https://issues.apache.org/jira/browse/IMAGING-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17180558#comment-17180558
 ] 

Bruno P. Kinoshita commented on IMAGING-264:
--------------------------------------------

Sounds sensible to me. Had a look around to see if I could find anything in the 
specifications about rounding resolution (which is a LONG), but had no luck.

For the sake of being consistent, I think it's OK that we change, as 
JpegImageParser is doing it too. Quickly created a BMP in GIMP, with dpi=72.6, 
reproduced the issue where it was rounded down to 72. Added the suggested 
`match.round`, and it produced 73.

> BMP Parser physicalWidthDpi and physicalHeightDpi truncated before rounding 
> off.
> --------------------------------------------------------------------------------
>
>                 Key: IMAGING-264
>                 URL: https://issues.apache.org/jira/browse/IMAGING-264
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: BMP
>    Affects Versions: 1.0-alpha2
>            Reporter: Ram
>            Assignee: Bruno P. Kinoshita
>            Priority: Minor
>             Fix For: 1.0-alpha3
>
>
> In BMPImageParser class, the values are typecasted to int before rounding off 
> so output varies(other parsers has this logic correct).
> int physicalWidthDpi = (int)((double)bhi.hResolution * 0.0254D);
> int physicalHeightDpi = (int)((double)bhi.vResolution * 0.0254D);
>  
> Expected :
> int physicalWidthDpi = (int)*Math.round*((double)bhi.hResolution * 0.0254D);
> int physicalHeightDpi = (int)*Math.round*((double)bhi.vResolution * 0.0254D);



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to