0

I want to be able to get a BufferedImage from a URL / a File and then return a subimage from it. The first issue is that when i try it with

BufferedImage b = null;   
b = ImageIO.read("url");

b just stays null.

Can anyone explain to me how to successfully initialize a BufferedImage, so that I can then get a subimage of it using

BufferedImage c = b.getSubimage(0, 0, 20, 20);
Warren Sergent
  • 2,542
  • 4
  • 36
  • 42
Toreole
  • 33
  • 1
  • 10

1 Answers1

0

I found it now by myself :^) I just did this :

img = ImageIO.read(new File(filePath));
BufferedImage img2 = img.getSubimage(0,0,100,100);
Toreole
  • 33
  • 1
  • 10