<story><title>The smallest 256x256 single-color PNG file, and where you&apos;ve seen it (2015)</title><url>https://www.mjt.me.uk/posts/smallest-png/</url></story><parent_chain><item><author>tppiotrowski</author><text>One thing I&amp;#x27;ve wondered about are size savings for DEM tiles. Typically elevation values are encoded in RGB values giving a resolution down to fractions of an inch [1]. This seems like overkill. With an elevation range from 0 - 8848 meters (Mt everest), you can use just 2 bytes and get an accuracy down to .2 meters. That seems plenty for many uses. Does anybody know if there&amp;#x27;s a PNG16 format where you can reduce the file size by only using 2 bytes per pixel, instead of the typical 3-byte RGB or 4-byte RGBA?&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.mapbox.com&amp;#x2F;data&amp;#x2F;tilesets&amp;#x2F;guides&amp;#x2F;access-elevation-data&amp;#x2F;#decode-data&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.mapbox.com&amp;#x2F;data&amp;#x2F;tilesets&amp;#x2F;guides&amp;#x2F;access-elevatio...&lt;/a&gt;</text></item></parent_chain><comment><author>geokon</author><text>Not my area of expertise, but in my limited experience DEM tiles are usually GeoTIFF. This can be 16bit greyscale. The catch is that these are actually signed... Elevation doesn&amp;#x27;t start at 0meters bc you have locations below sea level and you need to handle those corner cases somehow&lt;p&gt;What&amp;#x27;s funny is that you can parse a GeoTIFF as a .tiff most of the time but not always. I had fun debugging that :). Java&amp;#x27;s BufferedImage understandably doesn&amp;#x27;t directly support negative pixel values haha</text></comment>
<story><title>The smallest 256x256 single-color PNG file, and where you&apos;ve seen it (2015)</title><url>https://www.mjt.me.uk/posts/smallest-png/</url></story><parent_chain><item><author>tppiotrowski</author><text>One thing I&amp;#x27;ve wondered about are size savings for DEM tiles. Typically elevation values are encoded in RGB values giving a resolution down to fractions of an inch [1]. This seems like overkill. With an elevation range from 0 - 8848 meters (Mt everest), you can use just 2 bytes and get an accuracy down to .2 meters. That seems plenty for many uses. Does anybody know if there&amp;#x27;s a PNG16 format where you can reduce the file size by only using 2 bytes per pixel, instead of the typical 3-byte RGB or 4-byte RGBA?&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.mapbox.com&amp;#x2F;data&amp;#x2F;tilesets&amp;#x2F;guides&amp;#x2F;access-elevation-data&amp;#x2F;#decode-data&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.mapbox.com&amp;#x2F;data&amp;#x2F;tilesets&amp;#x2F;guides&amp;#x2F;access-elevatio...&lt;/a&gt;</text></item></parent_chain><comment><author>tristanc</author><text>The PNG format already allows grayscale 16bits &amp;#x2F; channel images. I regularly use this when rendering out depth maps from blender and ffmpeg seems to handle reading from these PNGs just fine (detecting the gray16 pixel format).&lt;p&gt;However I don’t know of any DEM tile apis that provide these sorts of PNGs but it sounds like a fun project!&lt;p&gt;Edit: I found this StackExchange post which shows how to generate 16-bit PNGs with gdal &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;gis.stackexchange.com&amp;#x2F;questions&amp;#x2F;246934&amp;#x2F;translating-geotiff-to-16-bit-png-with-gdal&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;gis.stackexchange.com&amp;#x2F;questions&amp;#x2F;246934&amp;#x2F;translating-g...&lt;/a&gt;</text></comment>