<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif">Travis,</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">I am not aware of a good way to do this.   What I do is create separate mask directories looking like te following.  Note the "Subfile Type: transparency mask (4 = 0x4)" directories.  It isn't clear that all applications will honor these, but modern GDAL treats this as a PER_DATASET mask, and modern GDAL using applications that honor this style of masking will support the mask properly.   I think modern QGIS does for instance, and MapServer.   I could do some digging for the GDAL script code that makes these if you like.  </div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">Best regards,</div><div class="gmail_default" style="font-family:arial,sans-serif">Frank</div><div class="gmail_default" style="font-family:arial,sans-serif"> </div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">$ tiffinfo 20200708_082104_1002_Browse.tif <br>TIFFReadDirectory: Warning, Unknown field with tag 33550 (0x830e) encountered.<br>TIFFReadDirectory: Warning, Unknown field with tag 33922 (0x8482) encountered.<br>TIFFReadDirectory: Warning, Unknown field with tag 34735 (0x87af) encountered.<br>TIFFReadDirectory: Warning, Unknown field with tag 34737 (0x87b1) encountered.<br>TIFFReadDirectory: Warning, Unknown field with tag 42112 (0xa480) encountered.<br>TIFF Directory at offset 0x17794e (1538382)<br>  Image Width: 5870 Image Length: 2889<br>  Tile Width: 256 Tile Length: 256<br>  Bits/Sample: 8<br>  Sample Format: unsigned integer<br>  Compression Scheme: JPEG<br>  Photometric Interpretation: YCbCr<br>  YCbCr Subsampling: 2, 2<br>  Samples/Pixel: 3<br>  Planar Configuration: single image plane<br>  Reference Black/White:<br>     0:     0   255<br>     1:   128   255<br>     2:   128   255<br>  ImageDescription: {"fp_center": [23.21221629852675, -19.107257323766635]}<br>  DateTime: 2020:07:08 08:21:04<br>  Tag 33550: 4.777314,4.777314,0.000000<br>  Tag 33922: 0.000000,0.000000,0.000000,2569932.323447,-2160669.364808,0.000000<br>  Tag 34735: 1,1,0,7,1024,0,1,1,1025,0,1,1,1026,34737,25,0,2049,34737,7,25,2054,0,1,9102,3072,0,1,3857,3076,0,1,9001<br>  Tag 34737: WGS 84 / Pseudo-Mercator|WGS 84|<br>  Tag 42112: <GDALMetadata><br>  <Item name="DESCRIPTION" sample="0" role="description">red</Item><br>  <Item name="DESCRIPTION" sample="1" role="description">green</Item><br>  <Item name="DESCRIPTION" sample="2" role="description">blue</Item><br></GDALMetadata><br><br>  JPEG Tables: (142 bytes)<br>TIFF Directory at offset 0xb6a (2922)<br>  Subfile Type: transparency mask (4 = 0x4)<br>  Image Width: 5870 Image Length: 2889<br>  Tile Width: 256 Tile Length: 256<br>  Bits/Sample: 1<br>  Sample Format: unsigned integer<br>  Compression Scheme: AdobeDeflate<br>  Photometric Interpretation: transparency mask<br>  Samples/Pixel: 1<br>  Planar Configuration: single image plane<br>  Predictor: none 1 (0x1)<br>TIFF Directory at offset 0x14b8 (5304)<br>  Subfile Type: reduced-resolution image (1 = 0x1)<br>  Image Width: 1468 Image Length: 723<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 8<br>  Sample Format: unsigned integer<br>  Compression Scheme: JPEG<br>  Photometric Interpretation: YCbCr<br>  YCbCr Subsampling: 2, 2<br>  Samples/Pixel: 3<br>  Planar Configuration: single image plane<br>  Reference Black/White:<br>     0:     0   255<br>     1:   128   255<br>     2:   128   255<br>  JPEG Tables: (142 bytes)<br>TIFF Directory at offset 0x1888 (6280)<br>  Subfile Type: reduced-resolution image (1 = 0x1)<br>  Image Width: 734 Image Length: 362<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 8<br>  Sample Format: unsigned integer<br>  Compression Scheme: JPEG<br>  Photometric Interpretation: YCbCr<br>  YCbCr Subsampling: 2, 2<br>  Samples/Pixel: 3<br>  Planar Configuration: single image plane<br>  Reference Black/White:<br>     0:     0   255<br>     1:   128   255<br>     2:   128   255<br>  JPEG Tables: (142 bytes)<br>TIFF Directory at offset 0x1aa8 (6824)<br>  Subfile Type: reduced-resolution image (1 = 0x1)<br>  Image Width: 367 Image Length: 181<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 8<br>  Sample Format: unsigned integer<br>  Compression Scheme: JPEG<br>  Photometric Interpretation: YCbCr<br>  YCbCr Subsampling: 2, 2<br>  Samples/Pixel: 3<br>  Planar Configuration: single image plane<br>  Reference Black/White:<br>     0:     0   255<br>     1:   128   255<br>     2:   128   255<br>  JPEG Tables: (142 bytes)<br>TIFF Directory at offset 0x1c68 (7272)<br>  Subfile Type: reduced-resolution image/transparency mask (5 = 0x5)<br>  Image Width: 1468 Image Length: 723<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 1<br>  Sample Format: unsigned integer<br>  Compression Scheme: AdobeDeflate<br>  Photometric Interpretation: transparency mask<br>  Samples/Pixel: 1<br>  Planar Configuration: single image plane<br>  Predictor: none 1 (0x1)<br>TIFF Directory at offset 0x1f56 (8022)<br>  Subfile Type: reduced-resolution image/transparency mask (5 = 0x5)<br>  Image Width: 734 Image Length: 362<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 1<br>  Sample Format: unsigned integer<br>  Compression Scheme: AdobeDeflate<br>  Photometric Interpretation: transparency mask<br>  Samples/Pixel: 1<br>  Planar Configuration: single image plane<br>  Predictor: none 1 (0x1)<br>TIFF Directory at offset 0x2094 (8340)<br>  Subfile Type: reduced-resolution image/transparency mask (5 = 0x5)<br>  Image Width: 367 Image Length: 181<br>  Tile Width: 128 Tile Length: 128<br>  Bits/Sample: 1<br>  Sample Format: unsigned integer<br>  Compression Scheme: AdobeDeflate<br>  Photometric Interpretation: transparency mask<br>  Samples/Pixel: 1<br>  Planar Configuration: single image plane<br>  Predictor: none 1 (0x1)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 19, 2022 at 3:19 PM Travis Kirstine <<a href="mailto:traviskirstine@gmail.com">traviskirstine@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I've been trying to create a COG with JPEG compression with transparent nodata values without much success.  Is this possible without creating a secondary mask? <br></div><div><br></div><div>Any hints?</div><div><br></div><div>Regards<br></div></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font face="monospace">---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up   | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>light and sound - activate the windows | +1 650-701-7823<br>and watch the world go round - Rush    | Geospatial Software Developer</font></div></div></div></div></div>