
Is FLIF the perfect format for images?

Just as the JPEG format revolutionized image formats at one time, the new FLIF format promises an event of the same scale for designers and web developers.
FLIF (Free Lossless Image Format) is a new file format for images that provides unprecedented lossless compression. Files are obtained:
- 14% less than WebP, no loss
- 22% less than BPG, no loss
- 33% less than compressed via ZopfliPNG PNG file
- 43% less than regular PNG files
- 46% less Adam7-optimized interlaced PNGs
- 53% less than JPEG 2000, lossless
- 74% less than JPEG XR, lossless
A couple of articles on the topic of FLIF have already been published on Habré . But we will go further: what other practical benefit does the format have, besides the smaller size for most types of images (in particular, for types without loss of quality)? Even if you take the format most suitable for a certain type of image from PNG, JPEG 2000, WebP or BPG, then FLIF compression is on average 12% better. And if the same test is carried out on 16-bit images that are not supported by WebP or BPG, then FLIF will be better by 19%. Below is a graph comparing with other formats, built on the previous version of the FLIF format, since then FLIF compression has improved slightly.

Works for any type of image.
Different compression formats work better with different image formats. PNG works well with images consisting of lines on a uniform background. For ordinary photos where partial loss can be tolerated, JPEG is best suited. For medical images where losses are unacceptable, JPEG 2000 is suitable. The
recently appeared WebP and BPG formats are also not suitable for all cases, as they have their pros and cons.
The advantage of FLIF is that it works well for different types of images. Therefore, the end user does not have to make a choice of the format used based on the type of image. By linka table is presented in Google Docs, which shows a comparison of different types of images and different compression formats applied to them. FLIF wins for all types of images.
For example, PNG does not work well for photos, and WebP, BPG, and JPEG 2000 provide better compression.

In medical images, PNG and WebP work relatively poorly, while BPG and JPEG 2000 are much better.

On maps, BPG and JPEG 2000 show very poor results, while PNG and WebP give good compression.

But in all 3 examples above, FLIF works better than the others.
Sequential loading and lossless
The FLIF format provides lossless compression, but it can also be used in situations where the user does not have a fast Internet channel. Only a small portion from the beginning of the file is sufficient to provide a relatively acceptable preview of the image.
Other formats also support sequential loading, such as PNG with Adam7 interlaced optimization, but FLIF works better.
→ The link shows a comparison of FLIF and PNG (Adam7)
Created Responsive
The development of responsive sites, such as those that fit the user's screen size, is now a hot topic, and not surprisingly. Now sites are accessed from a wide variety of devices. Desktop computers, laptops, smartphones, tablets, and more recently, smart TVs, wearable devices like Apple Watch and others - the variety of possible screen resolutions is unbelievable. HTML5 and CSS3 greatly facilitates the development of responsive sites, but one of the remaining problems is working with images.
Usually, when developing an adaptive website, different versions of the same image are created in different sizes for different resolutions. These versions of the same image are naturally stored in different files. It is assumed that it will be programmatically determined which version of the file is more suitable for a particular user with his device. There may be problems with caching, with the need to download several versions of the same image, if the user zooms in on the screen, and other problems. As a result, responsive sites do not work as fast as we would like. In addition, the presence of different versions of the same image additionally loads the server, since they all need to be stored and cached.
When using the FLIF format, the site needs only one image file - for all occasions. An image in FLIF format can be downloaded in different sizes from the same source file on the server. This is achieved by partial file download. Thanks to this, FLIF is great for creating responsive sites. Since the file is always one, the browser can start downloading it immediately, without waiting for the screen size to be determined. Downloading can be stopped when it is determined that a sufficiently large image has been downloaded. Moreover, you can continue downloading from the same place if you need to increase the size, for example, the user has increased the page viewing scale.
FLIF helps you make better use of client-side resources by determining the required file size at the moment based on any of the following:
- Screen resolutions and screen space for this image
- Currently available download speed
- Free space on disk and in memory
- Is this screen image currently visible?
Since only one file is required for each image, this can greatly facilitate the creation of typical site elements such as image galleries. Indeed, now a single file acts as a thumbnail of the image, its version for preview and its different versions for different resolutions.
Many caching options also exist. In the client-side cache, on proxy servers, or in the CDN, not full versions of a file can be stored, but only their versions cut off from the end of the file in accordance with the most frequent requests to them. In this case, the full version of the file can be downloaded, if necessary, from the source server.
Even if you do not consider the channel width as a limiter, FLIF can simplify the use of files in many situations. For example, large files may contain small preview versions of the images in the headers. In the case of the RAW format on many cameras, the files contain a full-size “preview” using the JPEG format with loss in quality and less color depth. In addition, many operating systems create cached image thumbnails. Their sole purpose is to speed up the display of the list of icons, and FLIF does not need it at all.
Free and without patents
Unlike formats such as BPG or JPEG 2000, FLIF is completely free from the need to make any deductions and is not protected by any patents. FLIF uses arithmetic coding, but all patents related to arithmetic coding have expired.
Format support
So far, no browsers support FLIF. Relevant queries are launched in Mozilla and in Chromium .
Of the graphic editors, FLIF supports ImageMagick and ExifTool .
You can use XnView , the Windows FLIF plugin for Windows Codec, or the QT FLIF plugin for QT4 and QT5 to view images.
In conclusion, we note that the format seems extremely interesting, both in terms of banal savings in file size and a more convenient implementation of adaptive web design. Hopefully, Adobe, Apple, Microsoft, Google and Mozilla will support this format as soon as possible.