[gdal-dev] Universal raster to rgba?

Michael Katz michaeladamkatz at yahoo.com
Wed Aug 30 13:18:14 PDT 2023


In our program, we want the user to be able to open and view any raster map. As I understand it, and as we use it in our program, the GDAL API lets you read all sorts of raster files, but it presents them to you in a general form: a certain number of bands, where the bands can have a certain data type (e.g., a double or an unsigned byte) and a certain meaning (e.g., red or grayscale or transparency). But we are left having to deal with all of the cases in order to transform it into an array of (unsigned byte) rgba pixels (i.e., an image to show on the screen). I was surprised there was no such function, and I also realize that expecting there to be such a function might show my lack of understanding of the range of possible raster file data types. But even if some files don't have a default rgba representation, it would be great to have a function that does its best with any given file. I asked Even R. about it a few years ago and his comment was "probably somebody must have done it". But I haven't found a library. Our current implementation takes care of many common cases but no doubt there are files out there that we display incorrectly even though they have a natural rgba representation. Am I wrong to think there could/should be such a function? Is there such a function?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230830/98fce9e4/attachment.htm>


More information about the gdal-dev mailing list