[gdal-dev] Get Image Endianness

Even Rouault even.rouault at mines-paris.org
Wed Feb 3 13:26:44 EST 2010


Alejandro,

There is no such general method in GDAL. Determining on disk endianness is 
format specific (it makes sense only for some formats) and, to the best of my 
knowledge, rarely/never exposed as a metadata that can be retrieved by the 
GDAL API. If you want it badly, you'll have to hack the appropriate drivers 
code to make them report the endianness.

Le Wednesday 03 February 2010 19:15:00 Alejandro Mostovoi, vous avez écrit :
> Thanks, the read of the image is resolved.
> But my app shows information about an open image, one data of that
> information is (or will be) the endianness of the image, I mean, the format
> of the image shouldn't be significant.
> I need some method o struct that return the endianness of the image.
>
> Thanks again.
> Alejandro.
>
> On 3 February 2010 15:03, Frank Warmerdam <warmerdam at pobox.com> wrote:
> > Alejandro Mostovoi wrote:
> >> Hi All,
> >>
> >> I need to know the image endianness.
> >> I search for in api's help and list but can't find anything.
> >>
> >> Any idea?
> >
> > Alejandro,
> >
> > As mentioned by others the on-disk endianess varies by format and
> > sometimes by file in a format.  The endianess of data returned by the
> > GDAL API is always
> > local machine order. So if you read a big endian file on a little endian
> > system, the RasterIO() calls will return the data to the application in
> > little
> > endian byte order.
> >
> > Best regards,
> > --
> >
> > ---------------------------------------+---------------------------------
> >----- I set the clouds in motion - turn up   | Frank Warmerdam,
> > warmerdam at pobox.com
> > light and sound - activate the windows |
> > http://pobox.com/~warmerdam<http://pobox.com/%7Ewarmerdam> and watch the
> > world go round - Rush    | Geospatial Programmer for Rent




More information about the gdal-dev mailing list