Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to open an image by giving path?

 
praveen livingstone
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a program where I get the pixel data from a gif image. for loading the image and getting an image object, i used this statement.

URL url = new URL("http://www.wizard.ca/pics/all_roads_desktop_800x600.gif");
Image m_image= Toolkit.getDefaultToolkit().getImage(url);

Is there any other way by which i can create an image object just by giving general path like "d:\pictures\all_roads_desktop_800x600.gif" instead of an url?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual way to opening image files is the javax.imageio.ImageIO.read method, which returns a BufferedImage object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic