Author: damjan Date: Wed Jun 27 18:47:35 2012 New Revision: 1354663 URL: http://svn.apache.org/viewvc?rev=1354663&view=rev Log: Fix BMP width and height DPI. Also enable testing this.
Jira issue key: IMAGING-82 Submitted by: Piyush Kapoor <pkapoor at adobe dot com> Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1354663&r1=1354662&r2=1354663&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java Wed Jun 27 18:47:35 2012 @@ -622,10 +622,10 @@ public class BmpImageParser extends Imag // boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0); // // pixels per meter - int physicalWidthDpi = (int) (bhi.hResolution * 1000.0 / 2.54); + int physicalWidthDpi = (int) (bhi.hResolution * .0254); float physicalWidthInch = (float) ((double) width / (double) physicalWidthDpi); // int physicalHeightDpi = 72; - int physicalHeightDpi = (int) (bhi.vResolution * 1000.0 / 2.54); + int physicalHeightDpi = (int) (bhi.vResolution * .0254); float physicalHeightInch = (float) ((double) height / (double) physicalHeightDpi); String formatDetails = "Bmp (" + (char) bhi.identifier1 Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java?rev=1354663&r1=1354662&r2=1354663&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java Wed Jun 27 18:47:35 2012 @@ -75,7 +75,7 @@ public class RoundtripTest extends Imagi new FormatInfo(ImageFormat.IMAGE_FORMAT_JPEG, true, false, COLOR_FULL_RGB, true, true), // new FormatInfo(ImageFormat.IMAGE_FORMAT_BMP, true, true, - COLOR_FULL_RGB, true, false), // + COLOR_FULL_RGB, true, true), // new FormatInfo(ImageFormat.IMAGE_FORMAT_PSD, true, false, COLOR_FULL_RGB, true, true), // new FormatInfo(ImageFormat.IMAGE_FORMAT_PBM, true, true,