• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Convert planarimage to image

 
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?
 
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?

 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic