1

I'm trying to get an image's Dimension online from a URL, like the person in this question:

Java/ImageIO getting image dimensions without reading the entire file?

However, I don't know quite how to use the code of the best answer there to get the result. I want to get the image's height and width without having to load it.

What do I put resourceFile as, if I have a URL that goes to an image?

Community
  • 1
  • 1

1 Answers1

1

See ImageIO.createImageInputStream(Object)?

Parameters:
input - an Object to be used as an input source, such as a File, readable RandomAccessFile, or InputStream.

Further, as @Hover comments:

..you would need the InputStream from the URL for this.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433