Skip to content

chore(deps): update skia-canvas to v4 - #1001

Merged
jacobk999 merged 7 commits into
mainfrom
chore/skia-canvas-4
Oct 27, 2026
Merged

jacobk999 merged 7 commits into
mainfrom
chore/skia-canvas-4

Conversation

@ugcodrr

@ugcodrr ugcodrr commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Description: skia-canvas 3 redrew the whole font sheet on every glyph pixel read, which made cards slow and the bot memory-heavy.

  1. A BedWars card renders in about 28 ms instead of 168 ms, and a Linux render run levels off around 770 MB instead of 1,900 MB.
  2. v4 skips PNG row filtering by default, so cards are about 58% bigger but encode about three times faster.
  3. On v4, setting an image's src to bad data no longer throws, so loadImage builds images with new Image(buffer), which still rejects them like 3.0.8 did.
  4. Backgrounds shift by a shade or two. Text-only cards are unchanged.

Testing: /bedwars, /guild and /status match main apart from a shade in the backgrounds.

skia-canvas 4.0.0 fixes native memory leaks on macOS and in canvas-creating
loops, honours { gpu: false } in the Canvas constructor, and ships its
binaries as per-platform optional packages instead of a postinstall
download.

Drawing an image that failed to decode now throws instead of drawing
nothing, so the Image intrinsic and the API's head renderer skip images
with no size, which keeps today's output for a bad download.

assets/public and assets/private still pin skia-canvas 3, so skia-canvas
stays in onlyBuiltDependencies for its postinstall.
Every image Statsify sends is now encoded by toPng() in @statsify/rendering
instead of calling canvas.toBuffer("png") at each of the 18 call sites, so
PNG export settings live in one place.

The helper keeps skia-canvas v4's default of no row filtering. Cards come
out larger but encode about three times faster, and the extra bytes only
cross the server's link to Discord.

@statsify/discord now depends on @statsify/rendering for the paginator.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
statsify Ignored Ignored Oct 26, 2026 9:49pm UTC

skia-canvas v4 already exports PNGs with no row filtering when no
options are passed, so toPng({ filters: "none" }) did the same thing as
canvas.toBuffer("png"). Calling toBuffer directly keeps the output and
drops the 18 call-site edits and the new @statsify/discord dependency on
@statsify/rendering.
packages/skin-renderer/pkg is ignored wasm build output that a local pnpm install picked up as a workspace package. main's lockfile doesn't list it.
Keep the why in the comments and leave the skia-canvas history to the PR. An image that failed to decode has neither a width nor a height, so the Image intrinsic checks width alone, like the API's head renderer.

@jacobk999 jacobk999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should look into using the using feature for canvases/images.

samizdatco/skia-canvas#307

@jacobk999
jacobk999 merged commit cd81e4e into main Oct 27, 2026
4 checks passed
@jacobk999
jacobk999 deleted the chore/skia-canvas-4 branch October 27, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants