Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

King of Men

Loading images in Java

This topic is 5298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use a JPG as the introduction screen for a game. I have gotten as far as loading an Image through the Toolkit.createImage(filename) method. However, Image is an abstract class; I don''t quite understand how to convert it to a BufferedImage. Maybe I don''t need this right now, but I''d still like to understand how Java''s image-handling works. Can anyone help me with this? I''ve tried looking through the API specification, but I have not found any Image-to-BufferedImage information. Does Toolkit automatically produce a BufferedImage, so it''s safe to use typecasting? I''m confused!

Share this post


Link to post
Share on other sites
Advertisement
Use ImageIO.read() to load images.

http://wiki.java.net/bin/view/Games/LoadingSpritesWithImageIO

[edited by - nonnus29 on June 9, 2004 8:12:16 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!