This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert planarimage to image

 
Manu Herrero Manu Herrero
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every one?
I have a renderedop or planarimage object, I'm trying to convert this renderedop image to image object.
My code is:
RenderedOp rImage = JAI.create("url", new java.net.URL(urlImage));
BufferedImage bImage = rImage.getAsBufferedImage();
Image image = bImage.getScaledInstance(bImage.getWidth(),bImage.getHeight(),java.awt.Image.SCALE_DEFAULT);

But it is appearing this error:
java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel.
at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:493)
at javax.media.jai.PlanarImage.<init>(PlanarImage.java:376)
...
Any idea?
How can I convert RenderedOp object into Image class object?
 
Richie Duggan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manu Herrero Manu Herrero:
Hi every one?

I have a renderedop or planarimage object, I'm trying to convert this renderedop image to image object.
My code is:

RenderedOp rImage = JAI.create("url", new java.net.URL(urlImage));
BufferedImage bImage = rImage.getAsBufferedImage();
Image image = bImage.getScaledInstance(bImage.getWidth(),bImage.getHeight(),java.awt.Image.SCALE_DEFAULT);


But it is appearing this error:

java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel.
at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:493)
at javax.media.jai.PlanarImage.<init>(PlanarImage.java:376)
...
Any idea?
How can I convert RenderedOp object into Image class object?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic