Introduction
WebP originally developed as a replacement for JPEG, PNG, and GIF file formats. It supports both lossy and lossless compression, animation and transparency. It has been actively developed since 2010, and is supported in all modern web browsers.
The Test
Ideally, if a JPEG is requested with an Accept
header that includes image/webp
, it will return an WebP image.
An example of checking for WebP using curl would look like this
$ curl 'https://cdn.example.com/imnage.jpg' \
-H 'accept: text/html,image/webp' \
-L -so output_image
From there, we check to see what the format of the returned image is.
$ file output_image
output_image: RIFF (little-endian) data, Web/P image
However, not all services offer respect accept headers, despite offering the image formats. In this case, they are manually set to Pass