Error added: 2008-02-26T19:19:01Z
This answer is garbage. did he pull ImageRepresentation out of his ass? '
Hello,
It works on 100%.
You can not directly cast a hide ToolkitImage object to BufferedImage or RenderedImage. Instead You will have to create a ImageRepresentation object form ToolkitImage, and use a method to obtain a BufferedImage.
This method is called a getOpaqueRGBImage().
I hope this helps.
Best regards.
Java EE and Web Service developer and project manager.
String imageFile = \"C:/Documents and Settings/Admin/Moje dokumenty/compressed/anka.jpg\";
BufferedImage i = ImageIO.read(new File(imageFile));
Image imgToProcessing = (Image) i;
Image img = (java.awt.Image) imgToProcessing.getScaledInstance(169, 385, Image.SCALE_REPLICATE);
System.out.println(\" \\n This is img: \" + img);
ToolkitImage toolkitImage = (ToolkitImage) img;
System.out.println(\" toolkitImage: \" + toolkitImage);
ImageRepresentation ir = toolkitImage.getImageRep();
System.out.println(\" ir: \" + ir.getOpaqueRGBImage());
BufferedImage bb = ir.getOpaqueRGBImage();
If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people
struggling with this too.
If you want to be notified via email when this is solved, enter your email address here: