This Leaflet plugin adds the
L.TileLayer.BPG class, a simple
This is a compressed image format created by Fabrice Bellard in later 2014 as a "better JPEG". It supports lossless and lossy compression. However, due to the different nature of lossy-compression artifacts it seems to also do a good job in places where you'd normally use the lossless PNG format, such as with digital map tiles.
In my tests with OpenStreetMap tiles using a custom mapnik stylesheet, .bpg-compressed tiles gave me an average 50-60% space saving without noticeable image deterioration (bpgenc -q parameter between 28 - the default - and 32). Interestingly even at 90% space saving linear features and labels were readable, only small and low-contrast features had disappeared, yet no problems at tile boundaries.
Tiles bigger than 256x256 would probably work even better but at 512x512 a metatile of 8x8 becomes quite heavy.
Same as L.TileLayer, same constructor arguments, only add the .BPG suffix.
Would it be possible to instead modify the L.TileLayer class to transparently support .bpg? Probably.
- Canvas support in the browser.
- The bpgdec.js file or one of its variants from libbpg. A version of bpgdec8.js is included with this plugin excluding the unneeded polyfill code.
TileLayer.BPG.js: 2-clause BSD.
bpgdec.js: BSD+LGPL-2.1 - see Licensing.