Discussion:
[gdal-dev] Alpha band data type
Evert Etienne (SITEMARK)
2021-06-02 19:44:39 UTC
Permalink
Dear all,

I was wondering if there is a best practice or guide for the data type of alpha channels in geotiffs.
I have many files where the data type is constant over all bands (UInt16 for example).
I would expect the alpha band to be a byte band or even bit.

Is it possible to have different types in a single file? If so, can I change the type of the alpha band alone to see if it has impact on the file size for example?

Many thanks

Evert
Javier Jimenez Shaw
2021-06-02 20:08:26 UTC
Permalink
Hi Evert,

As far as I know, TIFF data type is "constant" along the bands. You cannot
have a uint16 band and a byte band in the same page.
If you are worried about space, you can use the "nodata value", assigning a
single value for that purpose (assuming that you do not want intermediate
values, just on and off). However I do not know if this nodata is only for
GDAL -and widely used-, or in the (Geo)TIFF standard.

Cheers,
Javier
.___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Wed, 2 Jun 2021 at 21:44, Evert Etienne (SITEMARK) <
Post by Evert Etienne (SITEMARK)
Dear all,
I was wondering if there is a best practice or guide for the data type of
alpha channels in geotiffs.
I have many files where the data type is constant over all bands (UInt16 for example).
I would expect the alpha band to be a byte band or even bit.
Is it possible to have different types in a single file? If so, can I
change the type of the alpha band alone to see if it has impact on the file
size for example?
Many thanks
Evert
_______________________________________________
gdal-dev mailing list
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Even Rouault
2021-06-02 20:20:11 UTC
Permalink
Post by Javier Jimenez Shaw
Hi Evert,
As far as I know, TIFF data type is "constant" along the bands. You
cannot have a uint16 band and a byte band in the same page.
Yes, in theory this would be possible since the SampleFormat tag has as
many values as bands
(https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html),
but in practice libtiff only handles its value to be same for all bands
(and similarly for BitsPerSample)
Post by Javier Jimenez Shaw
If you are worried about space, you can use the "nodata value",
assigning a single value for that purpose (assuming that you do not
want intermediate values, just on and off). However I do not know if
this nodata is only for GDAL -and widely used-, or in the (Geo)TIFF
standard.
GDAL-only concept. See
https://www.awaresystems.be/imaging/tiff/tifftags/gdal_nodata.html
Post by Javier Jimenez Shaw
Cheers,
Javier
.___ ._ ..._ .. . ._. .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
On Wed, 2 Jun 2021 at 21:44, Evert Etienne (SITEMARK)
Dear all,
I was wondering if there is a best practice or guide for the data
type of alpha channels in geotiffs.
I have many files where the data type is constant over all bands
(UInt16 for example).
I would expect the alpha band to be a byte band or even bit.
Is it possible to have different types in a single file? If so,
can I change the type of the alpha band alone to see if it has
impact on the file size for example?
Many thanks
Evert
_______________________________________________
gdal-dev mailing list
https://lists.osgeo.org/mailman/listinfo/gdal-dev
<https://lists.osgeo.org/mailman/listinfo/gdal-dev>
_______________________________________________
gdal-dev mailing list
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
Loading...