Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


putting text and image to tiff file

Posted on 2005-04-16
Medium Priority
Last Modified: 2013-11-19

  Is there a java class to generate tiff file dynamically?Say i got a set of text and put it on a background image and i want to combine it to tiff file format. Can give me the any link to any website for reference?

thanks in advance.

Question by:sunmaster
  • 2
  • 2
LVL 92

Expert Comment

ID: 13796884
LVL 92

Accepted Solution

objects earned 675 total points
ID: 13796886
LVL 15

Assisted Solution

aozarov earned 675 total points
ID: 13799688
Did you try using ImageIO (standard api since 1.4) ? I think it can output a tiff format (Never tried it though)

Author Comment

ID: 13823173

but is there a simple example?

LVL 15

Expert Comment

ID: 13823616
Based on the example from javalamanc: http://www.javaalmanac.com/egs/javax.imageio/Graphic2File.html

import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;

public class Main
      public static void main(String st[]) throws Exception
            RenderedImage rendImage = myCreateImage();

            // Write generated image to a file
            try {
                        // Save as Tiff
                  File file = new File("newimage.tiff");
                  ImageIO.write(rendImage, "tiff", file);
            } catch (IOException e) {

      // Returns a generated image.
      public static RenderedImage myCreateImage() {
            int width = 100;
            int height = 100;

            // Create a buffered image in which to draw
            BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // Create a graphics contents on the buffered image
            Graphics2D g2d = bufferedImage.createGraphics();

            // Draw graphics
            g2d.fillRect(0, 0, width, height);
            g2d.fillOval(0, 0, width, height);

            // Graphics context no longer needed so dispose it

            return bufferedImage;

To run it you will need to add to your classpath the jars from: http://java.sun.com/products/java-media/jai/downloads/download-iio.html

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

575 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question