This discussion is archived
1 Reply Latest reply: Nov 29, 2012 4:24 AM by StanislavL RSS

how to convert a import com.lowagie.text.Image; to a java.awt.image?

975635 Newbie
Currently Being Moderated
I am trying to convert an itext image to a java.awt image

ByteArrayOutputStream bas = new ByteArrayOutputStream();
ImageIO.write((RenderedImage)image, "png", bas);

byte[] data = bas.toByteArray();

InputStream in = new ByteArrayInputStream(data);
BufferedImage finalImage =;

But at run time i get a ClassCastException.

Can anyone help me with this?



  • Correct Answers - 10 points
  • Helpful Answers - 5 points