Loading an Image in java program

How to load an image(.gif , .jpeg) in java program from computer directory to the java program

Comments

  • : How to load an image(.gif , .jpeg) in java program from computer
    : directory to the java program
    :
    You can use the ImageIO.read() method for that. Here's a sample code:
    [code]
    ImageIcon image = new ImageIcon(ImageIO.read(new File(filename)));
    [/code]
    For more info see the API description of ImageIO and BufferedImage.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion