Live data from Hacker News

FLIF – Free Lossless Image Format

flif.info

51–60 of 153 posts

Re: FLIF – Free Lossless Image Format

#51
post #36

If browsers supported APIs to allow "native" image/video/audio codecs to be written in JS, we could support new formats like this without needing any co-operation from the (very conservative) browser vendors. I wrote a proposal for this here: https://discourse.wicg.io/t/custom-image-audio-video-codec-a...

Seems like a good way to get a bazillion new formats that we won't be able to read anymore in 5 years.

But that's another advantage. Each image would have to be distributed alongside it's javascript decoder. Even if the format is abandoned, the decoder will still be there, and it will still work on that webpage.

Re: FLIF – Free Lossless Image Format

#52

If browsers supported APIs to allow "native" image/video/audio codecs to be written in JS, we could support new formats like this without needing any co-operation from the (very conservative) browser vendors. I wrote a proposal for this here: https://discourse.wicg.io/t/custom-image-audio-video-codec-a...

As a hacky workaround you can have the JS decompressor replace img tags with a canvas and draw on that, or create a data or blob URI and apply that to the img tag (I'm not sure which would be least efficient).

I assume that is how https://uprootlabs.github.io/poly-flif/ is adding support. I might have to have a browse around that project's code when I have some free time.

I doubt it would be practical for production use, but you never know...

Re: FLIF – Free Lossless Image Format

#53
Pretty amazing! Particularly nice is that an alpha channel and animation are also possible.

One critical sidenode: it seems FLIF is still not as good as JPEG when used as lossy compression (this is something the benchmarks do not show well).

For example, go to http://uprootlabs.github.io/poly-flif/, choose the monkey image, choose 'comparing with same size JPG', and set truncation to 60% or more.

Also, I'm not sure how efficient en- and decoding is for FLIF.

Re: FLIF – Free Lossless Image Format

#56
post #8

Does anybody understand how lossless JPEG works? To my mind, the whole point of JPEG is to get rid of high-frequency components.

This isn't how it actually works, but one way to turn a lossy decoder into a lossy one, is to send a diff of the actual pixels vs the encoded ones. Since the lossy compression will be close to correct, the diff will mostly be small values or 0's. Which is much easier to compress.

Likewise you can turn any lossless compressor into a lossy one, by modifying the pixels that are the hardest to compress. E.g. if there is a random red pixel in a group of blue pixels, you can make it blue, and save up to 3 bytes. Or you can discard color information that humans aren't very sensitive too anyway, like JPEG does. All lossless means is that the compression isn't required by the format itself.

Re: FLIF – Free Lossless Image Format

#57

Pretty amazing! Particularly nice is that an alpha channel and animation are also possible. One critical sidenode: it seems FLIF is still not as good as JPEG when used as lossy compression (this is something the benchmarks do not show well). For example, go to http://uprootlabs.github.io/poly-flif/ , choose the monkey image, choose 'comparing with same size JPG', and set truncation to 60% or more. Also, I'm not sure…

In the example you suggest using the hairs on the left side of the monkey's face have some significant artifacts. The quality of the jpeg is about the same as the FLIF file with a truncation of 80%, at which point the filesize is less than half the size of jpeg at 60%.

If the image quality of the 60% truncated jpeg is acceptable then you can get the same quality but half the size using FLIF at 80%.

Re: FLIF – Free Lossless Image Format

#58
post #36

Earlier quoted context omitted.

Seems like a good way to get a bazillion new formats that we won't be able to read anymore in 5 years.

But that's another advantage. Each image would have to be distributed alongside it's javascript decoder. Even if the format is abandoned, the decoder will still be there, and it will still work on that webpage.

Which means you need JavaScript just to look at the file. Does web archive store js along with the content?

Re: FLIF – Free Lossless Image Format

#60
post #7

I wonder if IE will adopt it? Firefox and Chrome are very responsive, Microsoft not so much.

Safari is much bigger problem than Edge/IE. No hope for WebM in Safari. WebM for Edge is in development.

It really depends on what it is - Edge is missing some rather fundamental modern CSS features (filters immediately springs to mind).
Post reply on HN