Skip to main content

Display image from BufferedImage

1 reply [Last post]
Joined: 2008-12-31

Dear friends,

I am creating a DICOM Viewer. Currently I am using Image, ImageIcon for displaying my image from dicom file. Please check my below code.

sourceImage = new SourceImage(attrList);
ImageIcon icon = null;
Image img = null;
BufferedImage buffImg = sourceImage.getBufferedImage();
img = buffImg;
icon = new ImageIcon(img);
JPanel imagePanel = new JPanel();
JLabel lbl = new JLabel(icon);

Now I want to display the image using JAI. Is it possible? I can get BufferedImage from sourceImage.getBufferedImage(); API. Using BufferedImage is it possible to display the image by using JAI apis? Please help.

Thanks and Regards

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-04-29

You could do this...
PlanarImage planarImg = PlanarImage.wrapRenderedImage(buffImg);

The see here for one way of displaying the PlanarImage using JAI...