<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I think either "rgb-dem" or "encode-rgb" could work. While not
strictly limited to RGB or DEMs, at least that's their typical and
intended use.</p>
<p>Sounds like a raster driver, rather than a new raster DEM mode,
would be advantageous. I imagine creation options might include:</p>
<p>- OFFSET (or BASE, as known in the terrain-RGB spec)<br>
Defaults to -10000</p>
<p>- SCALE (or maybe STEP, to not to confuse it with any required
scaling of the input?)<br>
Defaults to 0.1</p>
<p>- DRIVER<br>
Raster driver to output encoded image, e.g. PNG, WEBP, GTiff.
Inferred from the output extension if omitted.</p>
<p>- BANDS<br>
Order of raster bands to encode values into, most significant
first. E.g. "RGB", "RGBA", "BGR", "RG".<br>
Defaults to "RGB". If A is not included in the bands, the A
channel can be used for alpha.</p>
<p>For ease of use, perhaps an ENCODING option (or similar) could
provide preset values for the above, such as:</p>
<p>--co ENCODING=TERRAIN_RGB<br>
would be equivalent to<br>
--co OFFSET=-1000 --co SCALE=0.1 --co BANDS=RGB</p>
<p>-co ENCODING=TERRARIUM<br>
would be equivalent to<br>
--co OFFSET=-32768 --co SCALE=0.00390625 --co BANDS=RGB</p>
<p>This driver would allow things like:</p>
<p> gdal raster convert dem.tif rgb.png --of encode-rgb --co
DRIVER=PNG --co ENCODING=TERRARIUM<br>
</p>
<p> gdal raster convert dem.tif rgb.png --of encode-rgb --co
DRIVER=PNG --co ENCODING=TERRAIN_RGB<br>
</p>
<p> gdal raster convert dem.tif rgb.png --of encode-rgb --co
DRIVER=PNG --co BANDS=RGB --co OFFSET=-10000 --co SCALE=0.1</p>
<p> gdal raster convert dem.tif rgb.png --of encode-rgb --co
DRIVER=PNG --co BANDS=BG --co OFFSET=-1000 --co SCALE=1<br>
<br>
gdal raster tile --min-zoom 5 --max-zoom 15 --format ENCODE_RGB
--co DRIVER=PNG --co ENCODING=TERRARIUM dem.tif rgb-tiles/</p>
<p> gdal raster tile --min-zoom 5 --max-zoom 15 --format ENCODE_RGB
--co DRIVER=WEBP --co LOSSLESS=YES --co BANDS=RGB --co
OFFSET=-10000 --co SCALE=0.1 dem.tif rgb-tiles/</p>
<p>Certain creation options, like LOSSLESS=YES in the last example,
may need to be passed on from the ENCODE_RGB driver to the actual
output driver. Is that possible in general, or would it have to be
handled as special cases for different formats?</p>
<p>- Lars</p>
<div class="moz-cite-prefix">On 09/01/2026 07:02, Andrey VI via
gdal-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1767942127.779873340@f314.i.mail.ru">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div class="cl-d0nxoiarvd">Why not just "rgb-dem", i.e. "RGB
encoded DEM"?<br>
<br>
<div class="mail-quote-collapse">
<blockquote
style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><span>Friday,
January 9, 2026 3:16 AM +03:00 from rayg via gdal-dev <<a
href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>>:</span><br>
<div>
<div id="">
<div class="cl-j0sotz16cy">
<div
class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr">
<div id="style_17679177741572785247_mr_css_attr">
<div
id="style_17679177741572785247_BODY_mr_css_attr">Maybe
call it "scalar-rgb"? Because ultimately what
the encoding does is use the color channels to
hold a single value. It doesn't even have to be
for elevations at all.
<div> </div>
<div>Could also add swizzle options in case BGR
or some other order is used. And include the
alpha channel just in case, but also let alpha
be alpha if needed. If e.g. "A" is left off
from the swizzle option, then it's an actual
alpha channel.</div>
<div> </div>
<div>More general would be scalar encoding of
any multichannel (multiband) file, e.g. YCbCr,
HSV, CMYK, etc.
<div> </div>
<div>Ray<br>
<br>
<br>
<div
class="flockmail-quote-id-<af905f43-69e7-43cf-8e72-1db786df9a45@spatialys.com>_mr_css_attr flockmail-quote_mr_css_attr gmail_quote_mr_css_attr">
<div><span>On Thu, 8 Jan 2026 at 1:13 PM
Even wrote:</span></div>
<div class="mail-quote-collapse">
<div>
<blockquote
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"
class="gmail_quote_mr_css_attr">
<pre>>
> There's nothing especially terrain (or topography) about this afaics,
> and utility seems like the right approach rather than creating a
> format variant.
Actually Frédéric's intersting remark abou potential usage with "gdal
raster tile" would actually make the driver approach a better
choice.... unless we would extend "gdal raster tile" to accept a
pipeline to go to create a final tile from a 'raw' one, like 'gdal
raster tile --tile-pipeline="read ! encode-rgb --offset=-10000 ! write
--of PNG" --extension png in.tif out_directory' .
But a ENCODE_RGB driver approach is more simple than implementing that.
Even
--
<a href="http://www.spatialys.com" moz-do-not-send="true"
class="moz-txt-link-freetext">http://www.spatialys.com</a>
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<img width="0"
style="border:0;width:0;height:0;display:block"
src="https://cdn-east.knownhostlink.com/dc/t/mo/v2?t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJwIjoiMTAwMiA0NDkxNzExIGdkYWwtZGV2QGxpc3RzLm9zZ2VvLm9yZyAwZGJiN2I2Y2MyM2M3ZjhhMmE1NThlYmZkNzhiYzZlYiA0MjQ3MTkyODc1NTI1NzM0NiAxID8iLCJleHAiOjE3ODM0NjkyMjJ9.mjzhvnSKyBBQ0JcMwY0jLoYRCIXhg1PhYGG_BHs1lyvqwf9nL6En3xmGfGG5BUprGxIBJnTrdUZSEZmQ1T0MbA&requestId=i_09000649_SMR_3105_F79_SQFq"
height="0" class="flm-open_mr_css_attr"
moz-do-not-send="true"></div>
<div> </div>
<div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
<a
href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<div>--<br>
Andrey</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
</body>
</html>