Class BmpDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.bmp.BmpDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class BmpDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
Class reads BMP image as BufferedImage Example 1 (Using raw byte data):

 BmpDecoder decoder = new BmpDecoder();
 BufferedImage decodedImage = decoder.read(bmpBytes);
 
Example 2 (Using a File):

 File bmpFile = new File("C:\\path\\to\\file\\image.bmp");
 BmpDecoder decoder = new BmpDecoder();
 BufferedImage decodedImage = decoder.read(bmpFile);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(byte[] bmpData)
    Decodes and returns the BMP image as a BufferedImage from bytes
    read(File bmpFile)
    Decodes and returns the BMP image as a BufferedImage from a File
    readDimension(byte[] bmpData)
    Decodes and returns the width and height of bmp image
    Decodes and returns the width and height of bmp image

    Methods inherited from class com.idrsolutions.image.JDeliImage

    optimiseImage

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.idrsolutions.image.Decoder

    getImageCount, getImageCount, readEmbeddedThumbnail, readEmbeddedThumbnail, readImageAt, readImageAt, readImageSpecificMetaData, setMetadata
  • Constructor Details

    • BmpDecoder

      public BmpDecoder()
  • Method Details

    • read

      public BufferedImage read(byte[] bmpData) throws IOException
      Decodes and returns the BMP image as a BufferedImage from bytes
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      bmpData - byte[] containing the BMP data
      Returns:
      BufferedImage The decoded image
      Throws:
      IOException - if an error occurs in reading image
    • read

      public BufferedImage read(File bmpFile) throws IOException
      Decodes and returns the BMP image as a BufferedImage from a File
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      bmpFile - BMP file to be converted to a BufferedImage
      Returns:
      BufferedImage The decoded image
      Throws:
      IOException - if an error occurs in reading image
    • readDimension

      public Rectangle readDimension(File bmpFile) throws IOException
      Decodes and returns the width and height of bmp image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      bmpFile - image image contained in raw data if present
      Returns:
      width and height of image
      Throws:
      IOException - if problem reading image
    • readDimension

      public Rectangle readDimension(byte[] bmpData) throws IOException
      Decodes and returns the width and height of bmp image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      bmpData - image image contained in raw data if present
      Returns:
      Rectangle width and height of image
      Throws:
      IOException - if problem reading image