It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes Image -> BufferedImage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image -> BufferedImage" Watch "Image -> BufferedImage" New topic
Author

Image -> BufferedImage

Rick Gentry
Ranch Hand

Joined: Dec 14, 2002
Posts: 63
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

Joined: Feb 20, 2001
Posts: 580
Check out the javax.imageio.ImageIO clas for how to do this.


James Carman, President<br />Carman Consulting, Inc.
Rick Gentry
Ranch Hand

Joined: Dec 14, 2002
Posts: 63
thanks
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
No problem. Did you get it working?
Rick Gentry
Ranch Hand

Joined: Dec 14, 2002
Posts: 63
Actually I found a different workaround using createGraphics in BufferedImage, but thanks anyways.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image -> BufferedImage
 
Similar Threads
Extending BufferedImage
Jpeg images not proper in MAC
BufferedImage to Image
Create New Image Using 1.1
Can anyone help me to spot a mistake in the method.