Michael Celani
Michael Celani

Reputation: 181

How do I properly use this Image code?

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?

Upvotes: 1

Views: 132

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168835

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.

Upvotes: 1

Related Questions