Java BufferedImage Load loadImage(String classRelativeFile)

Here you can find the source of loadImage(String classRelativeFile)

Description

load Image

License

Open Source License

Declaration

public static BufferedImage loadImage(String classRelativeFile) throws IOException 

Method Source Code

//package com.java2s;
/*//w w  w  .  j  a v a 2s .  c o  m
 * Copyright 2002 and later by MH Software-Entwicklung. All rights reserved.
 * Use is subject to license terms.
 */

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;

public class Main {
    public static BufferedImage loadImage(String classRelativeFile) throws IOException {
        InputStream is = ClassLoader.getSystemResourceAsStream(classRelativeFile);

        if (is == null) {
            throw new IOException();
        }
        return ImageIO.read(is);
    }
}

Related

  1. loadImage(final String path)
  2. loadImage(final URL urlToImage)
  3. loadImage(Image image)
  4. loadImage(InputStream inputStream)
  5. loadImage(Object whoOrders, String name)
  6. loadImage(String filename)
  7. loadImage(String fileName)
  8. loadImage(String fileName, Component c)
  9. loadImage(String fileName, Component component)