I'm trying to split up an image of a deck of cards and store an individual card into an Image.
Image image; BufferedImage deck = ImageIO.read( new URL( "http://www.jfitz.com/cards/classic-playing-cards.png" ) ); image = deck.getSubimage( x, y, width, height ); incompatible types: BufferedImage cannot be converted to Image
Everywhere I've looked says that BufferedImage is an Image, this problem shouldn't exist. (Note: if this comes off looking like a class assignment, it is, but all we're supposed to do is load an image from a predetermined directory. I'm trying to take it a step further by using the URL for fun.)
EDIT 04/09/2014
I've been using different imports, so I guess the question I'm really trying to ask is how to convert a java.awt.image.BufferedImage to a java.scene.image.Image. Thanks for the help so far!
BufferedImageis a sub-class ofImage. What version of Java compiler are you using? Are you sure you're importing the correctImageclass?imageis of typejava.awt.image.Imageand isn't animagefrom some other package?importstatement are you using at the top of your file?java.awt.Image, in which case anyBufferedImagecan be assigned toimage(and the answers doesn't make much sense). The problem is most likely that you have the wrong import (likejavafx.scene.image.Imageor similar), or that you indeed want a different kind ofImage(in that case, you have to tell us which one to receive any meaningful help).