1001Ferramentas
๐Ÿ–ผ๏ธ Generators

Letter Avatar PNG Generator

Creates round PNG avatar (256x256) with name initials in a color derived from hash. Useful for chat UIs and profiles without photos.

Iniciais:
Cor:
Cor de fundo รฉ derivada do hash do nome (mesmo nome = mesma cor).

Letter avatar PNG: a raster fallback for legacy clients

A letter avatar PNG is the raster cousin of the SVG initials avatar โ€” pre-rendered at a fixed pixel grid (typically 64ร—64, 128ร—128, 256ร—256, 512ร—512) so it works in every place that does not speak SVG. The list of "every place" is longer than you'd think: Outlook on Windows strips SVG out of email signatures; Instagram, Discord and Slack only accept raster uploads for profile pictures; iOS home-screen icons (apple-touch-icon) require PNG; the Open Graph image consumed by WhatsApp link previews has to be PNG/JPG. So even projects that prefer inline SVG for the website ship a PNG version of the same avatar for those touchpoints.

Generation: Canvas, sharp, Pillow, Vercel OG

Four common pipelines, in roughly the order developers reach for them:

  • Browser Canvas API โ€” easiest in a tool like this. Draw circle + text on <canvas>, call canvas.toBlob('image/png'), trigger download. Zero server.
  • Node + sharp โ€” server-side batch generation. Render to SVG first, pipe into sharp's .png() with explicit width. Fast (libvips under the hood) and cacheable.
  • Python + Pillow โ€” common in Django stacks. ImageDraw.text() centred on a coloured circle.
  • Vercel @vercel/og โ€” JSX-style React component compiled to PNG via Satori. Trendy for OG images; overkill for a single letter avatar but handy if you want one component to power both avatar + OG card.

Sizes, compression and the right export grid

Most products settle on 256ร—256 as the master size and downscale on demand. It is large enough to look crisp on 2ร— Retina displays at 128 CSS pixels, small enough to keep filesize under ~5 KB after compression. Run the output through pngquant (8-bit palette quantisation) for a 60โ€“80% reduction with no visible loss; chain with optipng or oxipng for another 5โ€“15%. For the Apple Touch Icon slot, generate 180ร—180 separately โ€” iOS rejects anything not exactly that size. For Open Graph, generate 1200ร—630 with the letter avatar centred plus the brand name; same hash-coloured background ties it back to the avatar identity.

Caching and on-demand APIs

PNG raster generation is more expensive than SVG (rasterisation step + compression), so cache aggressively. The classic pattern: hash the user input โ†’ use as cache key โ†’ store the generated PNG on a CDN (Cloudflare R2, S3 + CloudFront, Vercel Edge Network). ui-avatars.com exposes the most popular public API for this: https://ui-avatars.com/api/?name=John+Doe&size=128 returns a PNG; cache at the CDN with a long TTL and forget about it. Self-hosted alternatives: boring-avatars (React component, render to canvas), avatar-placeholder (Express middleware), Cloudinary with text-overlay transformations.

PNG vs SVG: when to ship which

SVG wins on the web (one file, infinite sizes, ~500 bytes inline, no extra request). PNG wins everywhere else: email signatures (WiseStamp, Outlook), social profile uploads (Instagram, LinkedIn), iOS home-screen icons, OG/Twitter card previews, legacy clients that strip SVG. The pragmatic stack ships both โ€” SVG inline in the app shell, PNG cached at the CDN for export targets. Brazilian context: corporate environments running Outlook BR are still common โ€” email signatures need a PNG fallback no matter how modern your stack is.

FAQ

PNG or SVG? Both. SVG inline on the web for the cheapest render; PNG at the CDN for email, social uploads and iOS home-screen icons.

What size should I export? 256ร—256 as the master. Generate 64/128/512 variants for thumbnails and Retina; 180ร—180 dedicated for Apple Touch Icon.

Server-side or client-side? Client-side (Canvas API) is fine for one-off downloads in a tool like this โ€” no server cost, no privacy concerns. Server-side (sharp / Pillow / Vercel OG) is the move for cacheable APIs serving many users.

Will the colour match across PNG and SVG versions? Yes โ€” they both hash the same input string with the same algorithm and pick the same hue. Render the SVG and the PNG from one source of truth so they stay in sync.

Related Tools