[gdal-dev] Nodata is None, but still has blanks?

Frank Warmerdam warmerdam at pobox.com
Mon Jan 17 18:32:15 PST 2022


Matt,

Tiffinfo reports the following.  Note the "Transparency Mask" subfile.

$ tiffinfo sample-no-mask.tif
...
TIFF Directory at offset 0xe2 (226)
  Image Width: 304 Image Length: 285
  Tile Width: 512 Tile Length: 512
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  YCbCr Subsampling: 2, 2
  Samples/Pixel: 3
  Planar Configuration: single image plane
  Reference Black/White:
     0:     0   255
     1:   128   255
     2:   128   255
  Tag 33550: 100.000000,100.000000,0.000000
  Tag 33922:
0.000000,0.000000,0.000000,343739.586723,1091611.850704,0.000000
  Tag 34735:
1,1,0,7,1024,0,1,1,1025,0,1,1,1026,34737,21,0,2049,34737,6,21,2054,0,1,9102,3072,0,1,3578,3076,0,1,9001
  Tag 34737: NAD83 / Yukon Albers|NAD83|
  JPEG Tables: (142 bytes)
TIFF Directory at offset 0x33a (826)
  Subfile Type: transparency mask (4 = 0x4)
  Image Width: 304 Image Length: 285
  Tile Width: 512 Tile Length: 512
  Bits/Sample: 1
  Sample Format: unsigned integer
  Compression Scheme: AdobeDeflate
  Photometric Interpretation: transparency mask
  Samples/Pixel: 1
  Planar Configuration: single image plane
  Predictor: none 1 (0x1)

This is recognised by GDAL and treated as a special kind of mask as
indicated in the gdalinfo report:

$ gdalinfo sample-no-mask.tif
Driver: GTiff/GeoTIFF
Files: sample-no-mask.tif
Size is 304, 285
...
Origin = (343739.586723418149631,1091611.850704099284485)
Pixel Size = (100.000000000000000,-100.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (  343739.587, 1091611.851)
Lower Left  (  343739.587, 1063111.851)
Upper Right (  374139.587, 1091611.851)
Lower Right (  374139.587, 1063111.851)
Center      (  358939.587, 1077361.851)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET

In QGIS's "Information" tab under properties I see:

"More Information: Mask band (exposed as alpha band)"

So QGIS is using the special mask as alpha.   I find that if I do:

tiffcp sample-no-mask.tif,0 x0.tif

I get an "x0.tif" with just the jpeg image, and not the mask.  That may be
helpful for you (without uncompressing the jpeg image).

Best regards,
Frank




On Mon, Jan 17, 2022 at 7:38 PM <Matt.Wilkie at yukon.ca> wrote:

> I’m confused. The attached image has no Nodata, but when dropped into Qgis
> and ArcGIS large areas are still drawn transparently, and there is no 4th
> band for a mask or alpha. How is this happening?
>
>
>
> (I’m trying to get completely rid of all Nodata and Mask info, so as to
> start over creating one of those from blank slate).
>
>
>
> *Matt Wilkie*
>
> Geomatics Developer & Administrator
>
> Environment | Technology, Innovation and Mapping
>
> T 867-667-8133 | *Yukon.ca <http://yukon.ca/>*
>
> *Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.*
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | +1 650-701-7823
and watch the world go round - Rush    | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220117/c24f1698/attachment.html>


More information about the gdal-dev mailing list