File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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