TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Satori – Convert HTML and CSS to SVG

244 pointsby steventeyover 2 years ago

16 comments

crazygringoover 2 years ago
(Warning: bit of a tangent)<p>Conceptually, I love this.<p>Mainly because for some reason it irritates me than screenshots are bitmaps.<p>Nearly everything in a user interface or document is vector-based, except for photographs and natural-media illustrations.<p>The ability to capture part of a webpage as an SVG feels like a step forwards in preserving vector content.<p>My real wish is that OS interfaces would be just as vector-based, where rendering to bitmap was just something the OS handled at the end. So a screenshot in macOS or Windows would similarly always be SVG.
评论 #33156876 未加载
评论 #33158535 未加载
评论 #33157923 未加载
评论 #33161816 未加载
评论 #33164717 未加载
benschwarzover 2 years ago
We used this to generate dynamic share cards for our core web vitals checker tool (plug: <a href="https:&#x2F;&#x2F;calibreapp.com&#x2F;tools&#x2F;core-web-vitals-checker" rel="nofollow">https:&#x2F;&#x2F;calibreapp.com&#x2F;tools&#x2F;core-web-vitals-checker</a>).<p>Previously new uncached requests for Open graph share-card images were generated in Chrome, sometimes taking up to 5 seconds to generate. (They were then stored in cache for 12 hrs).<p>Because we&#x27;re now using Satori powered og images, they render almost immediately and we don&#x27;t have to own the problem of having Chrome deployed within the 50mb lambda limitation. I&#x27;m pretty happy about that.
评论 #33160106 未加载
seanwilsonover 2 years ago
You can do something like this via the browser by printing the page to PDF then using Inkscape to convert that to SVG. I documented this here: <a href="https:&#x2F;&#x2F;www.checkbot.io&#x2F;article&#x2F;web-page-screenshots-with-svg&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.checkbot.io&#x2F;article&#x2F;web-page-screenshots-with-sv...</a>. There&#x27;s a few caveats though like box-shadows getting converted into bitmaps and vectors not being grouped in layers like you&#x27;d expect, plus it&#x27;s heavyweight if you&#x27;re wanting to script it.<p>I&#x27;m curious if Satori could be used to capture in-app client-side screenshots accurately.
评论 #33157624 未加载
rockwotjover 2 years ago
I recently implemented a similar concept to this for HTML emails at shortwave.com, it only works for the subset of non table emails (which we assume are marketing emails and you want to see the full HTML). It allows us to render stuff wayyy faster (especially on mobile where webviews are not cheap). We don&#x27;t go all the way to pixel layout because we want to have some responsiveness, but it allows for heavily normalized emails (no more neon yellow on a green background with comic-sans font) and some other neat optimizations.<p>Didn&#x27;t use yoga but a from scratch implementation. A good starting point is let&#x27;s build a browser engine [1]. I hope to blog about it at somepoint.<p>[1]: <a href="https:&#x2F;&#x2F;limpet.net&#x2F;mbrubeck&#x2F;2014&#x2F;08&#x2F;08&#x2F;toy-layout-engine-1.html" rel="nofollow">https:&#x2F;&#x2F;limpet.net&#x2F;mbrubeck&#x2F;2014&#x2F;08&#x2F;08&#x2F;toy-layout-engine-1.h...</a>
aidosover 2 years ago
Interesting.<p>I was thinking that this was going to be a crazy amount of layout engine work, but now I look a little closer it <i>appears</i> the layout work is farmed out to yoga [0] (not trying to take away anything from the effort here). So this project is almost a wrapper around running yoga as a renderer and using SVG as a form of backend target?<p>I say &quot;appears&quot; because the yoga landing page doesn&#x27;t do a great job of explaining what it does.<p>EDIT Just looking at some of the information about the font side of things and the naming is a little confusing. You set embedFont=false to use text instead of converting the text to paths. embedFont=true sounds a lot like it will embed the _font_ required to render the _text_ - but it <i>kinda</i> does the opposite.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;vercel&#x2F;satori#font-embedding" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;vercel&#x2F;satori#font-embedding</a><p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;yoga" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;yoga</a>
elefantastischover 2 years ago
This seems really cool, but I don&#x27;t understand the use cases. Someone help me out?
评论 #33156201 未加载
评论 #33156808 未加载
petilonover 2 years ago
Converting text to SVG is super hard. Flowing English text is easy enough, but when it comes to Unicode text, with languages such as Arabic and Indian languages, that&#x27;s when it gets hard. I tried Satori, and it doesn&#x27;t handle Unicode very well, particularly, combining characters.
评论 #33159101 未加载
gnrlstover 2 years ago
Love the project! Sorry to be pedantic, but the claim is <i>technically</i> false. You don&#x27;t actually support HTML and CSS. You support JSX. As someone who doesn&#x27;t use React due to the abomination of mixing html and css within the JS, do you have plans to actually support regular HTML and CSS? Or provide a dedicated transpiler? (I&#x27;m not familiar with the react ecosystem, so likely one already exists?)
评论 #33161865 未加载
marsvinover 2 years ago
Alright, I like this, almost a lot!<p>In the 90&#x27;s there was a vector graphics editor called Satori. It was something beyond the understanding of us neighbourhood kids. Something beyond the Paint (and Paintshop Pro). Now let&#x27;s get back from the nostalgia trip...
评论 #33160610 未加载
searchableguyover 2 years ago
Does the tailwind support work with className declaration?<p>I would like to use it with existing component library which is built using tailwind without making changes. Is that possible?
评论 #33161694 未加载
评论 #33175103 未加载
gillesjacobsover 2 years ago
This would have been great for that one time I found a html+css copy-paste script for styled multiple underlined text. Doing it in LaTeX&#x2F;tikz directly would have taken me hours.<p>The html+css looked fine, but to get it to a vector image as required by the journal was a pain: print to PDF, find out the lines aren&#x27;t reproduced correctly, manually find a PDF printer with the right settings, convert to eps
lazyjeffover 2 years ago
Some of what looks challenging here is handling fonts. SVG would be so much better if there was a way to do font embedding. Even a minimal set of fonts would be amazing. Or if operating systems or libraries for SVG support could all commit to supporting a common set of fonts, like browsers did for web safe fonts. Think of how clunky the web would have been without those.
评论 #33156570 未加载
评论 #33156888 未加载
jjthebluntover 2 years ago
Is this not reminiscent of Display Postscript?
评论 #33159194 未加载
wslhover 2 years ago
Is Satori including it&#x27;s own HTML&#x2F;CSS renderer or relying on a browser behind the scenes?
评论 #33163159 未加载
lloydatkinsonover 2 years ago
Looks great but as far as I know for some reason no site supporting OG previews support SVGs
EugeneOZover 2 years ago
JSX, not HTML. Hate JSX.