Live data from Hacker News

The smallest 256x256 single-color PNG file, and where you've seen it (2015)

mjt.me.uk

101–104 of 104 posts

Re: The smallest 256x256 single-color PNG file, and where you've seen it (2015)

#101
post #75
post #30

With some dirty hacks, I got it down to 83 bytes: https://cdn.discordapp.com/attachments/286612533757083648/96... 00 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR| 10 00 00 01 00 00 00 01 00 01 03 00 00 00 66 bc 3a |.............f�:| 20 25 00 00 00 03 50 4c 54 45 b5 d0 d0 63 04 16 ea |%....PLTE���c..�| 30 00 00 00 1b 49 44 41 54 68 81 ec c1 01 0d 00 00 |....IDATh.��....| 40 00 c2 a0 f7 4f 6d 0f 07…

Still super bloated compared to the tiniest GIF: 47 49 46 38 39 61 01 00 01 00 00 ff 00 2c 00 00 00 00 01 00 01 00 00 02 00 3b http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ev...

That’s bloated ;-)

   P1
   1 1
   1
is a 9 byte 1 × 1 pixel black image in portable bitmap format (https://en.wikipedia.org/wiki/Netpbm#File_formats). Consumers of such files likely will know how to scale them to 256 × 256 pixels. The trailing newline may not even be necessary. If so, it would become 8 bytes.

Gray 1 X 1 pixel images in binary portable graymap format have the same size. To get a non-gray RGB color, you’ll need two more bytes in binary portable pixmap format.

Re: The smallest 256x256 single-color PNG file, and where you've seen it (2015)

#102

One thing I'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's a PNG16 format where you can reduce the…

The PNG format already allows grayscale 16bits / 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). However I don’t know of any DEM tile apis that provide these sorts of PNGs but it sounds like a fun project! Edit: I found this StackExchange post which shows how to generate 16-bit PNGs with g…

I hacked up a quick script and converted https://s3.amazonaws.com/elevation-tiles-prod/terrarium/0/0/... to 16-bit (2 channel) PNG.

Any value below sea level I set to 0. Any value above sea level I converted using the following formula:

scaled = elevation * Math.floor[(256 * 256) / (8849 - 0)];

top_byte = scaled / 256;

bottom_byte = scaled % 256;

This provides accuracy to 1/7th of a meter compared to 1/10th of a meter with Mapbox but the tile size went from 104KB -> 25KB. For applications that can ignore elevations below sea level, this is a huge savings.

Edit: the top level tile has a lot of ocean so the size savings are better than average. On a tile with no water, the savings appear to be around 50%.

Re: The smallest 256x256 single-color PNG file, and where you've seen it (2015)

#103
post #30

With some dirty hacks, I got it down to 83 bytes: https://cdn.discordapp.com/attachments/286612533757083648/96... 00 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR| 10 00 00 01 00 00 00 01 00 01 03 00 00 00 66 bc 3a |.............f�:| 20 25 00 00 00 03 50 4c 54 45 b5 d0 d0 63 04 16 ea |%....PLTE���c..�| 30 00 00 00 1b 49 44 41 54 68 81 ec c1 01 0d 00 00 |....IDATh.��....| 40 00 c2 a0 f7 4f 6d 0f 07…

Hadn't heard of JPEG XL until you mentioned it. The format looks really cool! Support for lossless and lossy compression, animation, and tons of other new features https://en.wikipedia.org/wiki/JPEG_XL Preliminary support in Firefox and Chromium nightly/testing builds already. I share your hope that we can start to use it in the next couple years. Looking at you, Safari ;)

There is this JPEG XL art gallery with very nice images 20-100 bytes e.g.: https://jpegxl.info/art/2021-04_jon.html

To see them, enable flag in chrome: chrome://flags/#enable-jxl

Re: The smallest 256x256 single-color PNG file, and where you've seen it (2015)

#104

Earlier quoted context omitted.

This already handled afaict. When I zoom in on apple maps on a stalled data connection I can see the sharp edges of the low resolution vector data until the higher resolution data is downloaded. SVG is convenient but isn't necessary.

On apple maps the app or on the web? Although I suspect that canvas + some homegrown vector engine it is.

The app. I'm not sure how the web interface behaves.
Post reply on HN