Thanks for the response, I think the original already had a mask layer, this was the output of tiffinfo:
Image Structure Metadata:
COMPRESSION=JPEG
INTERLEAVE=PIXEL
JPEGTABLESMODE=3
JPEG_QUALITY=90
Corner Coordinates: (skipped)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Overviews: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Mask Flags: PER_DATASET ALPHA
Overviews of mask band: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Unit Type: metre
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Overviews: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Mask Flags: PER_DATASET ALPHA
Overviews of mask band: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Unit Type: metre
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Overviews: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Mask Flags: PER_DATASET ALPHA
Overviews of mask band: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Unit Type: metre
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha
Overviews: 12907x15306, 6454x7653, 3227x3827, 1614x1914, 807x957, 404x479, 202x240
Unit Type: metre
In any case, using the command you provided make a new tiff, but with no transparency layer. I got a few errors like “ERROR 5: GDALDataset::GetRasterBand(3) - Illegal band #” at the start of conversion
I tried to make a new style to exclude the 4th layer, which seemed to work, however all the colours came out inverted. Any ideas?
<?xml version="1.0" encoding="UTF-8"?>
rgb_onlg
A raster style
1
2
3