1. Products
  2.   Image
  3.   JavaScript
  4.   PictureFill
 
  

QA Responsive Image Polyfill API for Different Web Applications

Picturefill is an easy to use, smart and responsive API that can be used in different web applications to make sure that users see the right size, screen resolution and more depending on the device.

As a responsive image polyfill API, Picturefill is open source and free to use and has been developed using Javascript and HTML. Mainly used for the front end of applications, it can make a great addition to any project where end users may have varying devices on which they access the application.

Picturefill provides additional support and features for the Picture and Img elements in browsers. It is one of the easiest way to ensure that no matter which device your users are accessing your website from, the images automatically adjust to their screen size and resolution. Picturefill has been tested for many browsers including Safari, Internet Explorer 9, Google Chrome Mozilla Firefox, and more.

Previous Next

Getting Started with PictureFill

The recommended way to install PictureFill via NPM. Please use the following command to install it.

Install PictureFill via NPM

 npm install picturefill

Add Responsive Images via Free JavaScript API

The open-source PictureFill library allows JavaScript developers to add responsive images to their site, including making sure that viewers with high pixel density viewports can see high resolution assets and it adjusts accordingly. Similarly, you can provide the browser with a number of images that are identical but with varying sizes. Picturefill will sort out and provide the best source for your user’s current viewport size, display density, and the size of the asset in the website’s layout. Picturefill also allows developers to decide which images are displayed depending on the user’s viewport. With the help of the picture element, you can specify various sizes, zoom levels, aspect ratios etc.

Specify Image Breakpoint via Free JavaScript API

Another feature of Picturefill is the ability to define specific image breakpoints with different resolutions options for source images on the website. Picturefill also provides the option to decide fallback images for image formats that are not supported on certain formats. This way your website won’t show image display errors.

Browsers Support

The open source Picturefill library has provided complete support for various types of browsers. The library is tested and works smoothly on a large number of browsers, such as Firefox, Google Chrome, Internet Explorer, Safari, Opera, and many more. When JavaScript is disabled, the browser can see the alt attribute text as a fallback. The library has included full support for IE9 and even the older version. For IE9 & later, you will need to wrap a video element wrapper around the source elements in your picture tag. The following example shows how to do it.

 English