Reputation: 181
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
Reputation: 168835
See ImageIO.createImageInputStream(Object)
?
Parameters:
input
- anObject
to be used as an input source, such as aFile
, readableRandomAccessFile
, orInputStream.
Further, as @Hover comments:
..you would need the
InputStream
from theURL
for this.
Upvotes: 1