5 ms·
SVG is such an under-appreciated graphics format. I will expand his great quote about graphics: > a two-dimensional representation to utilize the integrative c
by nologic01 3y ago
SVG is such an under-appreciated graphics format. I will expand his great quote about graphics:
> a two-dimensional representation to utilize the integrative capabilities of the human visual cortex
into:
SVG is a re-usable two-dimensional representation of data to utilize the integrative capabilities of the human visual cortex.
In a sense canvas, png/jpg etc are to SVG what PDF is to HTML. An information black hole.
As an example of the information-retaining quality of SVG representations you could fairly easily imagine the reverse operation: SVG Images TO Postgres.
- masklinn 3y ago> SVG is such an under-appreciated graphics format. SVG is an over-romanticised format. Support for logic makes it a major XSS vector, XML makes it inefficient, and the path langage makes it unreadable.
- asimpletune 3y agoAnd yet compared to the alternatives its advantages outweigh these flaws.
- nologic01 3y ago> the path langage makes it unreadable. at least this part seems over-the top criticism :-) Anything that can capture free-form graphical information will be unreadable. You could represent paths with points but that would make it more inefficient. The thing to keep in mind too is that because it fell out of favor the standard has not really evolved.
- masklinn 3y ago> at least this part seems over-the top criticism :-) Individually the XML and the path format are “fine”, the problem is that they’re both in the same file format. > Anything that can capture free-form graphical information will be unreadable. It’s not the question of being freeform, it’s the weird-ass single-letter command names in an attribute string. In an XML document which is otherwise self-descripting.
- dingledork69 3y ago[flagged]
- h0l0cube 3y ago> It’s not the question of being freeform, it’s the weird-ass single-letter command names in an attribute string. > In an XML document which is otherwise self-descripting. This is an odd plaint. M/m is for move, L/l is for line-to, C/c is for curve-to, V/v and H/h are for vertical and horizontal lines respectively, and svgo might throw some 's' curves in there. It's the best of both worlds, giving excellent compression while remaining human readable enough for a novice to manipulate geometry by just messing about.
- classified 3y agoSo what do you want? If it's readable, you call it inefficient, and if it's efficient, you call it unreadable. Make up your mind.
- masklinn 3y agoI don’t need to “make up my mind”, because the entire point is that SVG has all disadvantages thus having none of the advantages. It could be readable or efficient, and either would be fine, but it’s neither.
- jbaber 3y agoI love svg solely because it's an open vector format, not because it allows javascript, is xml, etc. Any plaintext vector format would be equally nice.
- jmisavage 3y agoAny language where you don’t know the syntax looks weird at first. There are 6 types of commands with 20 commands in total. Half of those use document based coordinate system and the other half are relative to the previous command.
- th0ma5 3y agoThe path language is somewhat a standard (lol) but is very similar to HPGL, glyph definitions in fonts, GCode, or even Logo and reading it is not a requirement.
- cassepipe 3y agoI wholehearedly agree with your point on information blackholes but I think the reason some people hate SVG is that they've had had to advanced things with or had to work with the spec and implement something around it. I haven't done so myself but I can tell pain when I read it. Here is a mostly compatible alternative: https://tinyvg.tech/ https://tinyvg.tech/
- cassepipe 3y agoI should add though that with this alternative you lose the readability of SVG because it's binary encoded
- TeMPOraL 3y ago> In a sense canvas, png/jpg etc are to SVG what PDF is to HTML. An information black hole. Tiny disagreement: PDF isn't necessarily an information black hole compared to HTML. PDF is a structured format, not quite plaintext, yet not quite binary either. It can preserve original text and formatting metadata. It's the publishing tools that often (these days less so than in the past) pre-rasterize data, storing bitmaps instead of original text inside the PDF. The nice thing PDF has going over HTML is fixing the layout. This is not desirable for most content of actual value (i.e. not glorified marketing brochures that half of the web is these days), but sometimes it is useful. These days, SVG could probably be used as plaintext PDF replacement (maybe with some extensions for pagination, and other print-related metadata), though I bet some people would still opt to "render" SVGs using embedded data-url/base64 images instead of text + metadata...
- nologic01 3y ago> not quite plaintext, yet not quite binary either this applies to SVG at low level as well (path data break with the semantically annotated pattern of higher level constructs). It is in some sense unavoidable / desirable to be able to include such numerical data intensive blobs. Where PDF (and its broader ecosystem) blundered is that it feels it would be rather low cost to maintain logic and metadata that would make re-usability of document information much easier. Of-course we talk with hindsight etc.
- aragilar 3y agoFor things of sufficient complexity (e.g. maths), fixing the layout beforehand gives benefits to readers and writers of such documents. Also, receiving PDFs (over HTML) is much better for any processes which involve printing/sharing outside the confines of the web. Can SVGs embed fonts? PDFs that don't embed fonts tend to have issues with rendering.
- wildrhythms 3y agoI deeply love SVG, I just wish they implemented some ability to do line wrapping with text. Today you have to use <foreignObject> and wrap a HTML element which doesn't play nice with a lot of SVG renderers. :(
- makeitdouble 3y ago> PDF is to HTML PDF is also an under-appreciated graphics format. It can be a mere container for more primitive data, but a PDF can do a lot more, way more than HTML (I mean, Postscript is Turing complete on its own)
- ctippett 3y ago> As an example of the information-retaining quality of SVG representations you could fairly easily imagine the reverse operation: SVG Images TO Postgres. I actually did this several years ago! I ended up collecting the floorplan/layout for most of Australia's largest shopping centres by scraping the SVGs from the interactive maps on their websites. I parsed the coordinates they contained — the location/size of individual shops, ingress/egress points, ATMs, etc — as Well-Known Text and stored them as native geometry data types in PostgreSQL. The shopping centres were even kind enough to leave labels and metadata embedded as attributes in the SVG. Bless.