aspose file tools*
The moose likes Beginning Java and the fly likes how to open an image by giving path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to open an image by giving path?" Watch "how to open an image by giving path?" New topic
Author

how to open an image by giving path?

praveen livingstone
Greenhorn

Joined: Apr 13, 2008
Posts: 7
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
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
The usual way to opening image files is the javax.imageio.ImageIO.read method, which returns a BufferedImage object.


Ping & DNS - updated with new look and Ping home screen widget
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to open an image by giving path?
 
Similar Threads
request.getHeader() return value ?
Sending image from servlet using standard java io
width and height using image object
request.getHeader()
Getting absolute path of image file