Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get Height and width without loading image in memory  RSS feed

 
Rohit Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to get height and width of an image without loading it in memory?

Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no
 
Rob Spoor
Sheriff
Posts: 21088
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't say "no" so definitely.

No, it can't be done with the Java API. However, I'm sure that you can retrieve this information if you read the image but don't store it. It must be in the meta tags or something somewhere.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
I wouldn't say "no" so definitely.

No, it can't be done with the Java API. However, I'm sure that you can retrieve this information if you read the image but don't store it. It must be in the meta tags or something somewhere.


Ok, even if you read the meta-data, the "file" still has to be in memory to be read. Even if you don't render the image, it is still in memory.
 
Rob Spoor
Sheriff
Posts: 21088
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But perhaps you only have to store a small part of the file, like only the first 50 bytes. That's still a lot better than the entire image.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
But perhaps you only have to store a small part of the file, like only the first 50 bytes. That's still a lot better than the entire image.


Ha, I was just answering the guys question.

Is it possible to get height and width of an image without loading it in memory?


The answer is no.
 
Rob Spoor
Sheriff
Posts: 21088
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then let's keep it at that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!