Live data from Hacker News

Using SVG as image placeholders

medium.com

131–139 of 139 posts

Re: Using SVG as image placeholders

#131
For small icons and images, this is fine and actually pretty cool. However, the rasterization cost of SVG into large images can be significant on mobile device CPUs. It won't speed things up much if the device is rasterizing a lot. That should be taken into account if you're mobile first or building a mobile app.

Re: Using SVG as image placeholders

#132

(Developer of Primitive here.) Love seeing people use my software in different ways! If this looks interesting to you, try it out: https://primitive.lol/ https://github.com/fogleman/primitive Also, I made a Twitter bot that posts samples every 30 minutes based on "interesting" Flickr photos using randomized Primitive settings: https://twitter.com/PrimitivePic

Very cool. Anything like this available for Windows?

You can download Golang and run it yourself from the windows command line. To make it easy to use, open the command window from the location your "go get" downloads to (usually in your documents there's a folder called "go"), then instead of using "primitive ", use "go run main.go . Works like a charm.

Re: Using SVG as image placeholders

#134
post #128

Earlier quoted context omitted.

Yes, for photographs. This shouldn't be surprising. Note that the FLIF home page doesn't even claim that FLIF is superior to normal JPEG images... it only claims that it's superior to other lossless formats. For lossless formats, you can compare your desired metric (e.g. file size) for your corpus. For lossy formats, you can either fix subjective quality and compare size, or fix size and compare subjective quality. (…

Which is why we need a replacement for Jpeg. While bpg / HEVC is a lot better, sometimes i wonder if we can do more. While I can shrink a 100kb Jpeg to 50Kb Bpg and looks better, what I really want is something 100Kb Jpeg quality at 30Kb or less. But given bpg or HELF isn't even being used yet. I know i am asking for a lot.

I didn't even know about BGP! BGP looks great.

Today I also learned that HEVC is another name for x265.

Re: Using SVG as image placeholders

#135

(Developer of Primitive here.) Love seeing people use my software in different ways! If this looks interesting to you, try it out: https://primitive.lol/ https://github.com/fogleman/primitive Also, I made a Twitter bot that posts samples every 30 minutes based on "interesting" Flickr photos using randomized Primitive settings: https://twitter.com/PrimitivePic

I went ahead and used it yesterday to change the background image of my site to save a couple (426kb) of bytes on page load. While you recommend using smaller image sizes, it still worked well on a 1920 x 1080 image and only took ~10 minutes to run in the background with n = 2500. I did add an additional step (as lots of extra triangles are generated with a large n like this), which is to put it through SVGOMG[1] to…

I suppose someone would write one eventually, but I don't really see the motivation to build or use libraries like SVGO for most use cases.

If you GZIP compress an SVG to SVGZ then you are going to save way more bytes, and if you have a half-decent webserver and a browser this side of 1999 it should do that automatically - https://en.wikipedia.org/wiki/HTTP_compression#Compression_s...

Re: Using SVG as image placeholders

#136
post #108

Earlier quoted context omitted.

Are you sure you're not thinking of interlaced GIF? That was used pretty widely for images in the days when the processing for jpeg could actually be serious work for a pc.

Possibly, I just remember being a grateful teenager when my adult images loaded progressively. Wouldn't gif have been a poor format for that even with progressive loading?

Probably, but the last time I really cared about load times enough that interlacing or progressive downloading was an issue would have been back in the early 90s on dialup and well before progressive JPEG was even a thing.

IIRC, watching a JPEG paint on a 386/25 or maybe an early 486 was something that could likely be measured in full seconds or tens of seconds, not tenths of seconds.

Re: Using SVG as image placeholders

#137
post #26

Earlier quoted context omitted.

Is “declarative SVG animation scripting” really a primitive API you need the browser to support directly? “Rewriting a big part of Actionscript functionality” seems like the job of a JS animation framework, not the browser. Like the ones that animation tools that previously compiled to Flash (e.g. Adobe Animate itself) use.

JS animations that can approach flash level quality are hard to do. It is like saying that you don't need native video support, but you use JS to interpolate initial image.

The latter is false because the APIs for image manipulation don't give you features like hardware video-compression-codec decoding, and so you just can't really drive a fast enough using JS to draw video on it.

The JS graphics+SVG APIs, however, do have all the right primitives exposed to let you do flash-level animation. It's not a matter of incapability; it's just a matter of nobody having coded the right framework, or the right framework (i.e. the one Animate uses) being proprietary and without an open-source attempt to clone it.

That doesn't suggest browser vendors should step in and put the capability into the browser, any more than the inability to do realtime 3D without a framework like three.js or a game engine like Unity's HTML5+WebAssembly engine, suggests that browsers should create a common, native game-engine-like API.

Re: Using SVG as image placeholders

#138
post #56

Earlier quoted context omitted.

If you've got JS turned off, isn't lack of image previews about the smallest issue you'll face?

Disallowing JS is really only an issue when using "rich" web apps. For reading articles composed of just pictures and text on random websites, running code is not (shouldn't be) really necessary. In this light, lack of images is a big problem: the user is forced to choose between not seeing half the content or running untrusted code.

I assume you'll still see the images, just not the previews.

Re: Using SVG as image placeholders

#139
post #46

Earlier quoted context omitted.

There are none that display cross browser however. Which is an issue.

Which current browsers you have in mind that don't support GIFs or Javascript + SVG (or canvas)?

Gifs don’t support vectors and the comment was talking about a more efficient format than SVG.

So what on earth are you talking about?

Post reply on HN