Beyka / Android-TiffBitmapFactory

MIT License
131 stars 46 forks source link

read elevation data from grayscale tiff #25

Closed Abdullah0991 closed 7 years ago

Abdullah0991 commented 7 years ago

Hi,

I tried to read a gray scale tiff image with RGB_565 image config option because the image pixels in stored in two bytes (16bit), when i read pixel value from the bitmap the value doesn't seem to be an elevation value.

how can i use the library for reading such files ? below is example:

TiffBitmapFactory.Options options = new TiffBitmapFactory.Options();

options.inJustDecodeBounds = false; options.inPreferredConfig = TiffBitmapFactory.ImageConfig.RGB_565; options.inDirectoryNumber = 0;

Bitmap bmp = TiffBitmapFactory.decodeFile(file, options); bmp.getPixel(1800, 3400);

Beyka commented 7 years ago

Hello RGB_565 is not option for deciding tiff. It is option to create android.Bitmap object. So Android bitmap will store every pixel in 2 bytes. And what is this elevation data? I didn't hear about this. Any way any time should be decode successful, I mean image should be correct. If it is not, please give me some image, that not decoded for analysis

Abdullah0991 commented 7 years ago

Hi, i am trying to read elevation data from GeoTiff files, tiff image with georeferenced data. in geotiff file the pixel value will be a spatial data like elevation -the height from earth surface-, i mean the pixel value stored in 2 bytes will be a number represent the elevation value like 250, 308 or 1250.

sorry for my poor English, here is an example geotiff image:

ASTGTM2_N35E036_dem.zip

Beyka commented 7 years ago

Oh, now I understand. Library hasn't support for geotiff now. Somewhere in future it will be added. Now you can't read this data, because I use libtiff to decode picture. While decoding libtiff convert any raw data to RGBA format. So any encoded data that is not real picture will be lost

Abdullah0991 commented 7 years ago

OK, thanks and wish you a good day. waiting for the new version with geotiff support :)