News for hackers. Stuff that matters.
Re:FLIF – Free Lossless Image Format by AshleysBrain on Monday March 07, 2016 @07:12AM (#11238432)
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...
Re:FLIF – Free Lossless Image Format by panic on Monday March 07, 2016 @07:54AM (#11238589)
Please, no! The web already makes my phone heat up enough as it is.
Re:FLIF – Free Lossless Image Format by AshleysBrain on Monday March 07, 2016 @03:47PM (#11241480)
The proposal I linked to suggests writing decoders using WebAssembly, so they should heat up your phone no more than the native image decoders in the browser itself.
Re:FLIF – Free Lossless Image Format by vram22 on Monday March 07, 2016 @03:21PM (#11241317)
Just had a wild thought:

I wonder how different the web would be [1] if all data was sent in binary instead of some (text, HTML, JS) being sent in text format. Or do some servers and clients gzip the text automatically before sending it. I've heard of stuff like that (and seen HTTP headers related to it), but haven't looked deeply into it.

[1] I mean in terms of speed. But there could be tradeoffs, because, though sending (smaller) binary data would be faster, the parts of it that represented text would have to converted to/from text at either end.

Re:FLIF – Free Lossless Image Format by Vendan on Tuesday March 08, 2016 @10:22AM (#11245717)
almost all servers support compression nowadays, and most clients as well. The HTTP headers and such won't get compressed, but there's a very good chance that every page and text asset you get has been compressed in transit. Some servers even have the option of precompressing assets and delivering them without having to stream through a compression algorithm, but that only works with static assets.
Re:FLIF – Free Lossless Image Format by vram22 on Wednesday March 09, 2016 @01:41AM (#11251342)
Interesting, that second point. Wonder how it is done. Via some background process that keeps monitoring asset dirs for new files, or does the user have to run a tool for that whenever they add new assets.
Re:FLIF – Free Lossless Image Format by Vendan on Thursday March 10, 2016 @11:31PM (#11264655)
However you choose to do so, i.e. usually via your deployment tool or something similar. One reference point: http://nginx.org/en/docs/http/ngx_http_gzip_static_module.ht...
Re:FLIF – Free Lossless Image Format by vram22 on Friday March 11, 2016 @08:50AM (#11266559)
Thanks. Will check it.
Re:FLIF – Free Lossless Image Format by staz on Monday March 07, 2016 @08:26AM (#11238710)
Seems like a good way to get a bazillion new formats that we won't be able to read anymore in 5 years.
Re:FLIF – Free Lossless Image Format by Houshalter on Monday March 07, 2016 @09:11AM (#11238903)
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 by ant6n on Monday March 07, 2016 @09:27AM (#11239016)
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 by acdha on Monday March 07, 2016 @01:49PM (#11240671)
Yes – modern web archiving tools capture JavaScript, CSS, etc. The basic support where they just download URLs found in HTML has been around for years but the current best-practice is to use a real browser engine (e.g. PhantomJS, Firefox) which has either been integrated to store directly or simply is using a proxy like https://github.com/internetarchive/warcprox which adds every requested resource to a WARC file (https://en.wikipedia.org/wiki/Web_ARChive).
Re:FLIF – Free Lossless Image Format by andyana on Monday March 07, 2016 @09:12PM (#11243157)
If they don't, they should.
Re:FLIF – Free Lossless Image Format by dspillett on Monday March 07, 2016 @09:16AM (#11238933)
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 by JonnieCache on Monday March 07, 2016 @09:40AM (#11239092)
That's how the BPG demo worked.
Re:FLIF – Free Lossless Image Format by ekianjo on Monday March 07, 2016 @07:15AM (#11238443)
So you would need to load up the JS decompressor every single time you load a webpage? Or is there another way to do it efficiently ?
Re:FLIF – Free Lossless Image Format by billpg on Monday March 07, 2016 @07:25AM (#11238481)
The browser would cache a copy.

I've seen proposals to add hashes to links. This way, a browser might see a link to some JS on a new URL, but with the hash, it might find it already has that JS file in its cache from when it downloaded it at a different URL.

Re:FLIF – Free Lossless Image Format by imaginenore on Monday March 07, 2016 @07:40AM (#11238530)
That's what Etag is for.
Re:FLIF – Free Lossless Image Format by eis on Monday March 07, 2016 @07:54AM (#11238590)
No it's not. Etag is completely different. It's a tag that the webserver sends together with the response and which the browser sends to the server which can then return a 304 status code to indicate that the resource has not changed and the browser can use the cached copy.

What the parent spoke about is adding some attribute to an anchor tag which specifies the hash of the resource so the browser can do safe cross domain caching without needing to do any request whatsoever.

Re:FLIF – Free Lossless Image Format by techdragon on Monday March 07, 2016 @08:20AM (#11238682)
Just what we need... More ways to shoot our own feet off while trying to improve performance.
Re:FLIF – Free Lossless Image Format by eis on Monday March 07, 2016 @08:34AM (#11238731)
First I don't immediately see how to shoot your feet off with this but maybe you can elaborate a bit on why you think so.

And secondly, am I getting this right that you are in favor of dumbing everything down while also sacrificing performance on the way because someone could break something?

Re:FLIF – Free Lossless Image Format by techdragon on Monday March 07, 2016 @08:56AM (#11238842)
I'm hardly in favour of dumbing things down, or sacrificing performance. I'm just frequently exposed to issues that are 'magically fixed' by purging the entire browser cache. And I'm just unnerved by the idea of this hash link scheme, we have enough bugs and gaps in the existing system without additional complexity, and that system is pretty damn simple conceptually, yet the bugs remain.

Anecdotally, I used to ship jQuery from a CDN for one project, I had to stop for that project I forget why... But I do remember that to my surprise, it turned out that when I shipped my own version of jQuery from my own domain, I got 10% less client side errors reported back to me in Sentry. The world is full of ways to shoot off your own foot, some of them even start out with someone showing you how they don't shoot their foot off.

Re:FLIF – Free Lossless Image Format by AshleysBrain on Monday March 07, 2016 @07:23AM (#11238479)
That's the downside - but if a JS decompressor library is served from a CDN, it only has to load it on the first site that uses it, like using jQuery from a CDN. Service Workers can also serve content like this from an offline cache, so it doesn't have to hit the server again on later visits.
Re:FLIF – Free Lossless Image Format by pcx on Monday March 07, 2016 @07:22AM (#11238474)
May be adding support using an extension/addon would work.
Re:FLIF – Free Lossless Image Format by pjc50 on Monday March 07, 2016 @07:36AM (#11238510)
Probably the best way to get this implemented is to encourage people to do the "polyfill"(+) solution of rendering to canvases. Browser implementers tend to follow actual usage, so the more widespread it is the more you can argue fait accompli.

(+) Does this share etymology with Polyfilla?

Re:FLIF – Free Lossless Image Format by MyNameIsFred on Monday March 07, 2016 @10:59AM (#11239556)
re: Pollyfilla Yes, I believe that's the idea.