WebP images now supported

Postmill now supports uploading images in the WebP format. And you thought this day couldn’t get any worse.

By default, WebP images are rejected (as they always have been), and support for them must be explicitly enabled by the instance operator.

The configurations shown here go in Postmill’s environment variables.

Rejecting WebP uploads

WEBP_MODE=reject

This is the default.

Converting WebP uploads

WEBP_MODE=convert

This converts WebP images into more reasonable formats:

  • If a WebP image is lossy and opaque, it will be converted to JPEG.
  • If a WebP image is lossless or transparent, it will be converted to PNG.

This mode is experimental. If serious problems with it are discovered, we may remove this option in a later version of Postmill.

Accepting WebP images as are

WEBP_MODE=accept

You can do this, and WebP will be treated as a native first class image type. Your users will hate you.

Caveats

  • libgd does not support animated WebP images, and uploading these will cause a message about image corruption.

  • Converted images may be larger than their source images. Hopefully they cannot be much larger.

  • Image metadata stripping has not been updated to support WebP. Given WebP is the annoying “I got a bad PageSpeed ranking without it” format, most uploads probably originate from Google Images anyway, and not from cameras or image manipulation software which are typically the cause for concern.

  • PHP’s gd extension must be built with libwebp enabled.


Follow @postmill.xyz on Bluesky, @postmill@mastodon.social on Mastodon, @postmill_xyz on Twitter, or subscribe to our RSS feed to stay up to date.