Share on Facebook Tweet on Twitter Share on LinkedIn Share by email
JPEG XR HttpModule for IIS

The JPEG XR HttpModule for IIS enables websites to transparently take advantage of the JPEG XR image format by automatically redirecting requests for JPEG and PNG images to a JPEG XR version (if one exists). This IIS module is currently deployed on the website where the use of JPEG XR can reduce the size of images by as much as 50% and their download time by as much as 45%; these gains are achieved without any extra effort from Microsoft Research staff because the JPEG XR image format has been fully integrated into the publishing platform of the website.


Date Published9 July 2013
Download Size0.01 MB

Note By installing, copying, or otherwise using this software, you agree to be bound by the terms of its license. Read the license.


When you’re responsible for ensuring the performance of a large, Internet-facing website, one of the many things you worry about is reducing the size of image files while maintaining their quality: smaller files mean less bandwidth is required to deliver them to the user’s browser.

So, when Rico Malvar, Distinguished Engineer and Chief Scientist of Microsoft Research (MSR), approached the team responsible for the MSR website,, and described a new image format, JPEG XR, which promised to do just that, the Web team was all ears.

JPEG XR is an approved ISO/IEC International standard (its official designation is ISO/IEC 29199-2) which has many advantages over JPEG and PNG, the two most commonly used image formats on the Web today. The advantages which were particularly attractive to the MSR Web team are:

  • Better compression: on average, the file size will be 40% smaller than JPEG for similar quality. In addition, the compression artifacts in JPEG XR are less objectionable than JPEG so there are often more file size savings available.
  • Lossless mode: the lossless mode in JPEG XR achieves better compression than PNG (especially for natural images).
  • Alpha channel: JPEG XR supports an alpha channel, unlike JPEG. PNG does support alpha, but, unlike PNG, JPEG XR has the capability to compress color lossy and alpha losslessly. This capability results in much smaller file sizes.

For a more complete description of JPEG XR, visit the HDView blog.

Integration of JPEG XR with

The MSR Web team ran a series of tests, converting sets of JPEG and PNG files to JPEG XR in order to evaluate the reductions in file size which could be expected:

  • For JPEG files, reductions of up to 70% were achieved, with an average of 40%.
  • For PNG files, reductions of up to 90% were achieved, with an average of 30%.

Because of these significant reductions in file size, the MSR Web team decided to proceed with the integration of JPEG XR into the publishing platform which supports the website.

Support for different browsers

JPEG XR is supported in many Microsoft products, notably Windows 7, Windows 8, Windows Phone 8, and Internet Explorer 10 (or later). Because JPEG XR isn’t currently supported in other popular browsers, such as Firefox and Chrome, the main challenge facing the MSR Web team was how to serve JPEG XR images only to browsers which support the format (and how to do this in a completely transparent way as far as the browsers are concerned): browsers which don’t support the format must continue to receive JPEG or PNG images.

The solution which the MSR Web team came up is an HttpModule for IIS which intercepts requests for JPEG and PNG images: if the user’s browser (as determined by the browser’s user-agent string) supports JPEG XR and a JPEG XR image with the same name as the originally requested JPEG or PNG image exists in the same location (but with the JXR extension), the request is redirected to the JPEG XR image.

The C# source code for this HttpModule is provided in this download.

Automation of JPEG XR file creation

The MSR Web team also wanted the use of JPEG XR to be completely transparent to users publishing content to the website. Therefore, the content management system (CMS) in the publishing platform was updated such that, when a JPEG or PNG image is added to the CMS, the system automatically creates and publishes a JPEG XR version of the image.

This end-to-end capability has been running in production since October 2012 and the results have more than justified Rico’s confidence in JPEG XR: for example, the time required to deliver images to a browser has been reduced by an average of 45% when JPEG XR images are delivered.

Project team
Rico Malvar
Rico Malvar

Matt Uyttendaele
Matt Uyttendaele

Ian Marriott
Ian Marriott

Related publications