Skip to content
ascend.
·7 min read

Share-card design: SVG vs PNG and why it matters

Dive deep into Ascend Fitness's share-card design. Discover why SVG-first ensures crisp visuals, tiny file sizes, and dynamic personalisation, and how we handle PNG fallbacks for social media. Boost y

dataclubresearch
Climber silhouetted on a snowy mountain ridge against blue sky
Illustration by Ascend
In this article

You’ve just crushed a new personal best on Ascend. Maybe you’ve logged a challenging workout, hit your nutrition goals, or ascended another 100 metres on Everest. What’s the first thing you want to do? Share that achievement! Our share cards are designed to make your victories pop, but there's a lot of engineering under the hood to make them perfect. At Ascend Fitness, we’re obsessed with performance and user experience, which is why we made a deliberate, opinionated choice for our share cards: SVG first. This isn't just a technical detail; it's a fundamental decision that impacts everything from how fast your card loads to how crisp it looks on your shiny new phone.

The Case for Crispness: Vector Graphics Rule High-DPI Screens

Imagine climbing a mountain. Every step is precise, every detail matters. The same goes for your share cards. On today's devices, especially those with 'Retina' or high-DPI displays, pixel-based images like PNGs can look... fuzzy. They're trying to stretch a fixed number of pixels across more physical pixels, leading to a noticeable degradation in quality.

This is where Scalable Vector Graphics (SVG) shines. SVGs are not made of pixels; they’re made of mathematical paths, shapes, and text. This means they are inherently resolution-independent. Whether viewed on an older phone or a cutting-edge 8K monitor, an SVG scales perfectly, rendering razor-sharp lines and crystal-clear text every single time. Your progress on Kilimanjaro will look just as majestic on a small smartphone screen as it would on a large desktop display, without any pixelation or blur. This commitment to visual fidelity is non-negotiable for Ascend, ensuring your hard-earned achievements always look their best.

Performance Matters: File Size and Load Times

Beyond aesthetics, performance is paramount. In a world where every millisecond counts, waiting for an image to load is frustrating. This is particularly true for share cards, which are often generated on the fly and shared across various platforms.

Consider the typical file size difference. A complex share card rendered as a PNG might weigh in at roughly 200 kilobytes (kB). The exact same card, when generated as an SVG, often comes in at a mere 20kB. That’s a tenfold reduction in file size.

This isn't just about saving a few bytes; it directly translates to: * Faster Loading: Quicker generation and transmission means less waiting for you and your friends. * Reduced Data Usage: Especially crucial for users on limited data plans or in regions with slower network speeds. A smaller file means less data consumed, a significant benefit for our global user base. * Improved User Experience: A snappier app feels more responsive and premium. Web performance studies, such as those often highlighted by Google's Core Web Vitals initiatives, consistently demonstrate that faster load times correlate with higher user engagement and satisfaction (Google I/O 2018). While our share cards aren't strictly 'web pages', the principle holds true for any digital asset.

Beyond Pixels: Accessibility and Dynamic Content

The advantages of SVG extend far beyond visual crispness and file size. They delve into critical areas like accessibility and the ability to personalise content dynamically.

Text Accessibility

When text is part of a PNG image, it’s just a collection of pixels. Screen readers can't interpret it, users can't select it, and search engines can't index it. It's effectively 'invisible' to anything but the human eye.

With SVG, text remains text. This means: * Screen Reader Compatibility: Users relying on assistive technologies can have their progress announcements read aloud, making Ascend more inclusive. Adherence to Web Content Accessibility Guidelines (WCAG) principles advocates for semantic content wherever possible (W3C WCAG 2.1). * Selectable and Searchable: While less critical for a share card, the underlying capability is there, offering a richer, more standard web experience.

Personalisation at Scale

Ascend Fitness thrives on personal progress. Your name, your current mountain, your elevation gain, your specific workout stats – these are all unique to you. If we were using PNGs, every single share card would need to be rendered from scratch as a new image file on the server. This is computationally expensive and slow.

With SVG, we simply manipulate the existing XML structure. A serverless function can take a base SVG template and inject your specific data – your climber name, your latest elevation, your workout duration – directly into the SVG code. This is a lightning-fast process that doesn't involve heavy image rendering, allowing us to generate highly personalised cards efficiently and at scale. It’s the difference between drawing a new picture every time versus merely updating labels on a blueprint.

The Practical Pipeline: Generating Ascend's Share Cards

So, how does this work in practice? Our pipeline is engineered for efficiency and adaptability:
  1. Serverless SVG Generation: When you request to share your progress, a lightweight serverless function springs to life. It takes your unique Ascend profile data and dynamically populates an SVG template. This process is incredibly fast, often completing in milliseconds, and the resulting SVG file is tiny.
  2. Optional PNG Render via Headless Chromium: This is where our pragmatic approach comes in. While SVG is superior in many ways, some platforms, most notably Instagram, still require raster images (like PNGs or JPGs) for sharing. They simply don't support direct SVG uploads.
To bridge this gap, if a raster format is needed, our serverless function then passes the generated SVG to a headless Chromium instance. This essentially runs a web browser without a graphical interface, allowing it to 'render' the SVG just as a browser would, and then take a high-quality screenshot, saving it as a PNG. This ensures that even when a raster image is necessary, it's derived from the highest quality source possible.

When PNG Still Has Its Place: The Raster Fallback

It’s important to acknowledge that no single technology is a silver bullet. While Ascend prioritises SVG, there are legitimate reasons for its raster counterpart. The prime example, as mentioned, is social media platforms. Instagram, for instance, is built around photos and videos – inherently raster formats. Trying to force an SVG directly would simply not work.

Our strategy, therefore, is not to eliminate PNG but to relegate it to a secondary, derived role. The SVG is the 'master' source of truth for your share card, guaranteeing quality and efficiency. The PNG is a high-fidelity 'export' of that master, created only when absolutely necessary for compatibility with specific platforms. This gives us the best of both worlds: superior performance and quality where possible, and seamless compatibility everywhere else.

FeatureSVG (Scalable Vector Graphics)PNG (Portable Network Graphics)
File SizeVery small (e.g., ~20kB for a share card)Larger (e.g., ~200kB for a share card)
ResolutionResolution-independent (scales infinitely)Pixel-based (can pixelate on high-DPI screens)
CrispnessAlways razor-sharpCan be blurry/pixelated on different resolutions
AccessibilityText is selectable, searchable, screen-reader friendlyText is embedded as pixels, inaccessible
Dynamic PersonalisationEasy to manipulate content (text, shapes) programmaticallyRequires full re-rendering of the entire image
PerformanceFaster load times, lower data usageSlower load times, higher data usage
Browser/Platform SupportExcellent in modern browsers and appsUniversal, especially for social media platforms
Best Use CaseLogos, icons, graphs, dynamic content, UI elementsPhotos, images with complex gradients, social media uploads
The choice between SVG and PNG for something as seemingly simple as a share card might seem minor, but it’s indicative of Ascend Fitness’s broader philosophy. We believe in leveraging the best technology to deliver an unparalleled user experience – one that is fast, accessible, beautiful, and efficient. By going SVG-first, we ensure that every time you share your progress, you're doing so with an image that truly represents the quality and dedication you put into your fitness journey. We’re constantly optimising, constantly improving, so you can focus on what matters most: reaching your summit.

Ready to start your ascent and share your progress with stunning, efficient share cards? Join the waitlist and begin your journey today!

Share:XThreadsEmail
Written by

Sam Wilson

Solo founder of Ascend Fitness. Building a gamified fitness tracker in Auckland, NZ. Lifts, runs, writes about both.

Ready to start climbing?

Beta climbers get TestFlight access, 14-day Ascend Club free trial, and a permanent founder discount on annual.

Join the waitlist