Blog: Tech Talk

agsdix-fas fa-home

Blog: Home

agsdix-fas fa-pen-fancy

Blog: CEO's Corner

agsdix-fas fa-code

Blog: Tech Talk

Blog: Product Releases

Blog: Conversion

arrow left circle icon Blog: Tech Talk

Using the Java Library to Create a BufferedImage Object

by | Apr 24, 2012

Many users of the RasterMaster Java imaging SDK have existing code that uses java.awt.Image and java.awt.image.BufferedImage objects to process image data. You can use RasterMaster to create BufferedImage objects from any of the file formats supported by RasterMaster. Here is an example:


* @param filename The full path of the image file

* @param pageNumber The index of the page to load


* @return BufferedImage object with data loaded from the specified file


public BufferedImage loadBufferedImage (String filename, int pageNumber)


Snowbnd snow = new Snowbnd();

int stat = snow.IMG_decompress_bitmap(filename, pageNumber);

int width = snow.getWidth();

int height = snow.getHeight();

BufferedImage bufImage = new BufferedImage(width,



Graphics bufG = bufImage.getGraphics();

snow.IMG_display_bitmap_aspect(bufG, this, 0, 0, width, height, 0);

return bufImage;


Now, whenever you need an instance of java.awt.Image, you can make the following call:

Image myImage = loadBufferedImage (“c:/images/myImage.jpg”, 0);