Skip to main content

adding annotations to a TIFF image

4 replies [Last post]
petem103072
Offline
Joined: 2005-05-05

We use annotations along with TIFF images. I have a need to combine the annotations along with the TIFF image and merge them into one image that can be put into a pdf using a tool called iText. Can JAI knit together annotations with the TIFF image?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23

Brett is basically correct about adding annotations via a Graphics2D object. You can do this by loading the image into either a BufferedImage or a TiledImage, creating the Graphics2D object and then writing the graphics into it. You also have the possibility of modifying the original TIFF file in place using the replacePixels() capability of the TIFF ImageWriter. This is only possible however if the image is uncompressed.

Brian

bpb
Offline
Joined: 2004-06-23

Please explain what you mean by annotations. The TIFF plug-ins in JAI-Image I/O should be able to handle almost all TIFF metadata (fields and IFDs).

> We use annotations along with TIFF images. I have a
> need to combine the annotations along with the TIFF
> image and merge them into one image that can be put
> into a pdf using a tool called iText. Can JAI knit
> together annotations with the TIFF image?

petem103072
Offline
Joined: 2005-05-05

Here is a description of annotations that I picked up from the following link: http://www.teraview.ca/newsletters/dec04.pdf
----------------------------------------
There is a process called Tiff annotations that allows you to make changes to
your scanned images. This works by scanning in a commonly used document
and typing on top of it so that you will not need to rescan the document over and
over again.
----------------------------------------
What we do is scan in an image and do precisely what this document says. We type over the document with notes (annotation). The annotations are stored as a "LONG RAW" in an Oracle database. The TIFF itself is stored in a file system. Currently we use an Active X component to display the image. What we want to do is write a JAVA based application that can combine the annotations with the TIFF to create one image that we can write to a PDF.

Brett@Zamora.com
Offline
Joined: 2006-02-17

Consider this psuedo-code...

Read TIFF file into BufferedImage object.
Create Graphics2D object.
Draw image from BufferedImage object onto Graphics2D object.
Draw annotation text onto Graphics2D object.
Create IIOImage object from Graphics2D object.
Create PDF ImageWriter and ImageOutputStream.
Write IIOImage out.

Regards,

Brett