May have to parse out the file header and find the width/height. I do something similar in PHP generating thumbnails, but it has more memory available. There is a function there that reads the header and reports values, but notes that it isn't accurate 100% of the time, so I ended up loading it to get the size then figuring the ratio to get the largest side within the thumbnail bounds and apply that ratio to both sides to keep it at the proper scale and not stretch. Loading may be a problem for Android memory though.