Package javajs.img

Class BMPDecoder

java.lang.Object
javajs.img.BMPDecoder

public class BMPDecoder extends Object
src: http://www.javaworld.com/article/2077542/learn-java/java-tip-43--how-to- read-8--and-24-bit-microsoft-windows-bitmaps-in-java-applications.html see also: http://en.wikipedia.org/wiki/BMP_file_format Modified by Bob Hanson hansonr@stolaf.edu
Author:
Bob Hanson (hansonr@stolaf.edu)
  • Constructor Details

    • BMPDecoder

      public BMPDecoder()
  • Method Details

    • decodeWindowsBMP

      public Object[] decodeWindowsBMP(byte[] bytes)
      original comment: loadbitmap() method converted from Windows C code. Reads only uncompressed 24- and 8-bit images. Tested with images saved using Microsoft Paint in Windows 95. If the image is not a 24- or 8-bit image, the program refuses to even try. I guess one could include 4-bit images by masking the byte by first 1100 and then 0011. I am not really interested in such images. If a compressed image is attempted, the routine will probably fail by generating an IOException. Look for variable ncompression to be different from 0 to indicate compression is present.
      Parameters:
      bytes -
      Returns:
      [image byte array, width, height]