<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hello,</DIV>
<DIV> </DIV>
<DIV>I tried command line below that is copied from <A
href="http://www.gdal.org/gdal_translate.html"><FONT
face="Times New Roman">http://www.gdal.org/gdal_translate.html</FONT></A>:</DIV>
<DIV> </DIV><PRE style="BORDER-BOTTOM: rgb(196,207,229) 1px solid; BORDER-LEFT: rgb(196,207,229) 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 15px; WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(251,252,253); TEXT-INDENT: 0px; MARGIN: 4px 8px 4px 2px; PADDING-LEFT: 6px; LETTER-SPACING: normal; PADDING-RIGHT: 6px; FONT-FAMILY: ; WORD-WRAP: break-word; ORPHANS: 2; COLOR: ; OVERFLOW: auto; BORDER-TOP: rgb(196,207,229) 1px solid; BORDER-RIGHT: rgb(196,207,229) 1px solid; WORD-SPACING: 0px; PADDING-TOP: 4px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=fragment><FONT style="FONT-SIZE: 9pt">gdal_translate rgba.tif withmask.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR --config GDAL_TIFF_INTERNAL_MASK YES</FONT></PRE>
<DIV> </DIV>
<DIV>It doesn’t generate transparency channel in output. But if I removed
options “-b 1 –b 2 –b 3”, the output image ‘withmask.tif’ would contain
transparency channel, that could be observed by opening the image in the
Photoshop. But if I remove all options to modify command line like this:</DIV>
<DIV> </DIV><PRE style="BORDER-BOTTOM: rgb(196,207,229) 1px solid; BORDER-LEFT: rgb(196,207,229) 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 15px; WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(251,252,253); TEXT-INDENT: 0px; MARGIN: 4px 8px 4px 2px; PADDING-LEFT: 6px; LETTER-SPACING: normal; PADDING-RIGHT: 6px; FONT-FAMILY: ; WORD-WRAP: break-word; ORPHANS: 2; COLOR: ; OVERFLOW: auto; BORDER-TOP: rgb(196,207,229) 1px solid; BORDER-RIGHT: rgb(196,207,229) 1px solid; WORD-SPACING: 0px; PADDING-TOP: 4px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=fragment><FONT style="FONT-SIZE: 9pt">gdal_translate rgba.tif withmask.tif </FONT></PRE>
<DIV> </DIV>
<DIV>The transparency channel is still generated in output even the option
‘-mask’ is not specified at all. And the last alpha channel in the source image
is always picked up as transparency channel to the output no matter what band
number is given to the ‘-mask’ option. Then I tried the same command line on a
new RGB tiff that has more than 4 channels and output image doesn’t contains any
transparency channel even ‘-mask band’ option is explicitly specified. </DIV>
<DIV> </DIV>
<DIV>It seems that the option ‘-mask’ doesn’t work and generating the
transparency channel is only depends on the colorspace (RGBA or Greyscale +
alpha). Please let me know how to correctly use this option.</DIV>
<DIV> </DIV>
<DIV>Thanks!</DIV>
<DIV> </DIV>
<DIV>Peter Z</DIV></DIV></DIV></BODY></HTML>