OOP-ResearchMake It Simpler by Object Oriented Programming

OOP ImageUtil API: Java API to convert JPEG, PNG, GIF and WBMP images to/from BufferedImage by JAI

ImageUtil is the Java API to scale down JPEG, PNG, GIF and WBMP images by JAI (Java Advanced Imaging API). The width/hight of the image can be reduced to fit within the specified rectangle. ImageUtil also implements methods for converting the binary contents in JPEG, PNG, GIF and WBMP to/from a BufferedImage object.

Putting it all togather : OOP Bento framework

This Java API is now a part of OOP Bento framework. In this MVC framework by XML, you can write all the GUIs in the web application in the normal HTML, XHTML, WML, HDML or any other mark-up languages. And you no longer need to bother about the user authentication and the session tracking. Because its full working source code example will be the good starting point of this Java API, please also visit the web site of Bento framework.

Related Pages:


Introduction ...

ImageUtil is the Java API to scale down JPEG, PNG, GIF and WBMP images by JAI (Java Advanced Imaging API). The width/hight of the image can be reduced to fit within the specified rectangle. The ratio of width/height of the original image will be left unchanged. This Java API is useful to show the large image on the small screen of the WAP phone (mobile phone). For instance, Servlet can send the binary contents of the scaled JPEG image to the WAP device.

Go Site Map

Do you need BufferedImage?

When the image file is uploaded to your Servlet, its binary contents will be available in JPEG, PNG or GIF format. To manipulate the uploaded image file, those binary contents should be converted to a BufferedImage object. After your Servlet finishes to work on a BufferedImage object, it should be serialized back into the binary contents in JPEG, PNG, GIF or WBMP format to be send back to the web browser or to be stored into the SQL table. ImageUtil implements methods for converting the binary contents in typical image formats to/from a BufferedImage object.

Go Site Map

IIOException: Unexpected block type 0! on GIF

Java Image I/O API was introduced in JDK 1.4 . And you can use:

  • javax.imageio.ImageIO

to obtain an ImageReader object for the specific image format. The ImageReader object reads the binary contents from the image file, and returns the BufferedImage object. But, ImageReader for GIF has a bug and throws:

  • Get IIOException: Unexpected block type 0! on GIF file

when it reads some GIF files. For details, please read:

Even in case of such a GIF file, ImageUtil can read and return a BufferedImage object. So, this API will be the good workaround for the bug in JDK.

Go Site Map

Download

This API is now a part of Bento framework. There are the better documentations and source code examples on the web site for Bento framework. There, you will also find the link to download the entire framework or each API in it.

Caution!
All the APIs for Servlet/JSP introduced by this web site are now included in Bento framework:
  • Simpler than JSTL or Apache Struts
  • MVC framework by HTML
  • Input validation from CGI FORM
  • Easy user authentication
  • Easy localization (L10n)
To download the APIs and source code examples, please visit the web site of Bento framework.


JBuilder 2007


General Information

For Java Development

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


ALL CONTENTS COPYRIGHT 1997-2007, OOP-Research Corporation. All rights reserved.