0

Add WebP image format support

Since Firefox 65 added support for WebP, users may be interested
in having maps that use WebP images. Support for this is added in
this commit, along with documentation for it.

A new option, "imglossless", controls whether we write out lossless
or lossy WebP images. The generic name "imglossless" as opposed to
a more specific "webplossless" was chosen in case future image
formats we also implement also support lossless/lossy modes in the
same format (JPEG-XL? AV1 image format?).

It's an okay meme but lossy mode really falls apart on our sorts
of images on the more zoomed out composite tiles, resulting in
pretty blurry messes. Might be due to a PSNR bias in the encoder,
which is to be expected from Google.
This commit is contained in:
Nicolas F
2019-03-04 17:04:09 +01:00
parent 7f63dfe315
commit 61ebd35240
5 changed files with 46 additions and 11 deletions

View File

@@ -694,16 +694,29 @@ Image options
``imgformat``
This is which image format to render the tiles into. Its value should be a
string containing "png", "jpg", or "jpeg".
string containing "png", "jpg", "jpeg" or "webp".
.. note::
For WebP, your PIL/Pillow needs to be built with WebP support. Do
keep in mind that not all browsers support WebP images.
**Default:** ``"png"``
``imgquality``
This is the image quality used when saving the tiles into the JPEG image
format. Its value should be an integer between 0 and 100.
This is the image quality used when saving the tiles into the JPEG or WebP
image format. Its value should be an integer between 0 and 100.
For WebP images in lossless mode, it determines how much effort is spent
on compressing the image.
**Default:** ``95``
``imglossless``
Determines whether a WebP image is saved in lossless or lossy mode. Has
no effect on other image formats.
**Default:** ``True``
``optimizeimg``
.. warning::