Manipulating TIFF Images Using Java and J2EE
Written by Artis IT Webmaster  
Monday, 26 November 2007

The following article describes how Artis IT, a Jacksonville Florida based custom software development company, implemented an Integrated FAX/Document Management Solution using J2EE. This is meant to be a high level overview of the architecture and technology used to accomplish a predefined business requirement.

Overview

Artis IT was recently presented with a challenging business requirement – to automate receipt and processing of inbound faxes. One of our customers was spending a great deal of time in manually processing documents received via a traditional analog fax machine. This was due to number of faxes received – on the order of 50,000 in bound messages per month. After some cost feasibility analysis, it was determined that a solution to automate this business process could significantly save the customer money in the operations area. At completion, the customer wanted to have a system in place to automatically receive these faxes and store them within a document imaging database.

Artis IT selected the J2EE platform and Java language to overcome this problem. J2EE was selected based on its ability to provide the services and resources typically required when developing a robust application like a document management solution. The J2EE implementation used consisted of a set of clustered instances of JBoss Application Servers (version 4) running inside Sun Java JDK/JRE (version 1.4) virtual machines. In addition to the built-in libraries provided by the J2EE technology stack and the JRE, Artis IT selected two add-on products that are available to the general public via open source licensing:

• Quartz for scheduling jobs to run on a regular basis (like Unix cron)
• Java Advanced Imaging Toolkit

I would like to offer my thanks to these two community-minded groups for their contributions to the open source world.

The following is a high level diagram of the integrated document processing solution using J2EE, Java and Image Processing.

mdb-using-jai-thumbnail.jpg

 

Converting Analog Fax into TIFF via a Fax Server

The first step in providing a solution to this problem was to digitize the analog fax document. We accomplished this using a traditional fax server; the fax server was able to convert the inbound messages into an image file. Artis IT selected a fax server that allowed the received fax to be converted into a TIFF file. There are many commercial products and services available today that will perform this task. Additionally, most fax machines and servers have the ability to convert faxes to TIFF, JPG, GIF or PDF. Once the file had been converted to a TIFF file, Artis IT used the email forwarding capability of the fax server to deliver the image file via email to an email server. The email server acted as the processing queue for inbound messages while waiting to be processed.

Reading the Queue (Email Server)

On a scheduled and periodically recurring basis (using Quartz), the imaging processor would connect to the email server using the JavaMail API and download new email messages and their contained TIFF attachments. Once these messages were “pulled off” of the email server, they were serialized and placed onto a typical persistent JMS queue. Artis IT selected the J2EE standard message driven bean interface, a type of enterprise Java bean, to asynchronously process messages pulled off of the email server and placed on the queue. The MDB would watch the JMS queue and upon the arrival of a new serialized message, would process it according to the predefined business rules.

Manipulating TIFF Images with Java and JAI

TIFF, or Tag Image File Format, is one of the most commonly used file formats for storing and archiving images. Due to TIFF’s widespread use, Artis IT selected this format as the basis for the document imaging and fax integration project. Based on this selection, we needed to develop a set of libraries to work with that would allow us to manipulate (paginate, re-order, rotate, zoom in, zoom out, etc.) the inbound image documents.

JAI, the Java Advanced Imaging API, was selected by the Jacksonville-based software development team to provide the ability to manipulate the image information within fax server-generated TIFF files. JAI is an add-on that you install within the JRE. JAI allows you to manipulate TIFF files (as well as many other image file formats like GIF, JPG and PNG) within Java using stream readers and writers. With JAI, Artis IT was able to manipulate into “byte arrays”. These “byte arrays” represented the contents of the TIFF image files. The JAI API, accessible via the javax.imagio Java package, has a variety of tools that allow you to manipulate and modify images as typical Java objects. We found JAI to be very full-featured and well-supported by the JAI development community. In the diagram above, these capabilities were present within the “JAI ImageBean”.

Storing These Images within a Database

After the images were decoupled from the email messages and processed off of the JMS queue, they were stored in a relational database management system for storage and retrieval. Artis IT selected Oracle 10g as the database management system for this task. Additionally, the image file contents were stored in Oracle BLOB (binary large objects) columns. Using JDBC and JNID-based data sources, we were able to insert the image contents into the database.

About Custom Software Development and Artis IT

If you are interested in obtaining more information on the aforementioned software development project or would like more information on Artis IT, please feel free to visit our Contact Us page. Artis IT is based in Jacksonville, Florida and specializes in custom software development using a variety of technologies like Java, J2EE, JBoss, Oracle and many others. Technically speaking, we know IT!

Last Updated ( Friday, 07 March 2008 )