Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image -> BufferedImage

 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BufferedImage bImage = (BufferedImage)Toolkit.getDefaultToolkit().getImage("picture.gif");

That's giving me a ClassCastException. I'm assuming it's because I'm trying to cast to a child which is illegal. I really don't know. Anyways, how do I get an Image into a BufferedImage so I can get to all of the functionality of BufferedImage?
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the javax.imageio.ImageIO clas for how to do this.
 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem. Did you get it working?
 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I found a different workaround using createGraphics in BufferedImage, but thanks anyways.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic