title: Using "gdal_translate" from .TIF to .JPG how to set background to white?
body: <p>I tried using the following line:</p>
  
  <pre><code>gdal_translate -of jpeg -a_nodata 0 -b 1 -b 2 -b 3 c:\myfolder\mytif.tif c:\myfolder\myNewtif.jpg
  </code></pre>
  
  <p>This produces the image with wanted specs, but turns the background to black  (transparency?), eventhough the original has white. Can I accomplish a white background with just gdal_translate? </p>
  
  <p>File dump of a file with mask: 
  <a href="https://filebin.net/f15v63to2x3cc4z0" rel="nofollow noreferrer">https://filebin.net/f15v63to2x3cc4z0</a></p>
  
  <p>File dump of a file with no a mask: <a href="https://filebin.net/kc940hqotcoeny0w" rel="nofollow noreferrer">https://filebin.net/kc940hqotcoeny0w</a></p>
  
  <blockquote>
    <p>gdalinfo output of a Tif that produces white background as expected:</p>
  </blockquote>
  
  <pre><code>Driver: GTiff/GeoTIFF
  Files: test.tif
  Size is 4799, 3196
  Metadata:
    TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
    TIFFTAG_XRESOLUTION=300
    TIFFTAG_YRESOLUTION=300
  Image Structure Metadata:
    COMPRESSION=LZW
    INTERLEAVE=PIXEL
  Corner Coordinates:
  Upper Left  (    0.0,    0.0)
  Lower Left  (    0.0, 3196.0)
  Upper Right ( 4799.0,    0.0)
  Lower Right ( 4799.0, 3196.0)
  Center      ( 2399.5, 1598.0)
  Band 1 Block=4799x1 Type=Byte, ColorInterp=Red
  Band 2 Block=4799x1 Type=Byte, ColorInterp=Green
  Band 3 Block=4799x1 Type=Byte, ColorInterp=Blue
  </code></pre>
  
  <blockquote>
    <p>Tif that produces black background:</p>
  </blockquote>
  
  <pre><code>Warning 1: TIFFFetchNormalTag:Incompatible type for "RichTIFFIPTC"; tag ignored
  Driver: GTiff/GeoTIFF
  Files: 100011_1.tif
  Size is 1640, 2401
  Metadata:
    TIFFTAG_DATETIME=2020:01:13 12:29:55
    TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
    TIFFTAG_SOFTWARE=Adobe Photoshop 21.0 (Windows)
    TIFFTAG_XRESOLUTION=300
    TIFFTAG_YRESOLUTION=300
  Image Structure Metadata:
    COMPRESSION=LZW
    INTERLEAVE=PIXEL
  Corner Coordinates:
  Upper Left  (    0.0,    0.0)
  Lower Left  (    0.0, 2401.0)
  Upper Right ( 1640.0,    0.0)
  Lower Right ( 1640.0, 2401.0)
  Center      (  820.0, 1200.5)
  Band 1 Block=1640x39 Type=Byte, ColorInterp=Red
    Mask Flags: PER_DATASET ALPHA
  Band 2 Block=1640x39 Type=Byte, ColorInterp=Green
    Mask Flags: PER_DATASET ALPHA
  Band 3 Block=1640x39 Type=Byte, ColorInterp=Blue
    Mask Flags: PER_DATASET ALPHA
  Band 4 Block=1640x39 Type=Byte, ColorInterp=Alpha
  </code></pre>
  
  <p>Also of the following images that have black background after translate, gdal produces this warning "<code>Warning 1: TIFFFetchNormalTag: Incompatible type for "RichTIFFIPTC"; tag ignored</code>" </p>