Detect WebP, JP2 / JPEG 2000 and JXR / JPEG XR browser support in PHP

WebP image format support

WebP image format is available from

  • Chrome 23
  • Opera 12.1
  • Opera Mini
  • Android Brower 4.3
  • Opera Mobile
  • Chrome for Android
  • Partial support in older Chrome, Opera and Android, not supporting lossless and alpha versions of WebP.

WebP support detection is simple, check Accept Header for image/webp.

JP2 image format support

JPEG-2000 or JP2 is available from

  • Safari 5 (Not in the Windows version)
  • iOS Safari 5.1

Because Safari 5 only represents 0.22% of browser usage on the world, we are going to ignore the Windows/Mac detection and start from version 6.
Safari Accept Header does not specify JP2 support, so as a fallback we are going to check if the browser is Safari, and check it’s version.

JXR image format support

JPEG XR format is available from

  • IE 8
  • Edge 12

JPEG XR support detection is simple, check Accept Header for image/webp.

This image format compression is great without too much quality downgrade, but converting images to JXR in command line is buggy with ImageMagick, and difficult with libjxr-tools.

Future image format support

For future browser release, check caniuse.com website, it provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.

Leave a Reply