Skip to content

fix(avatar): freeze APNG and animated WebP avatars, not just GIF#772

Merged
mremond merged 1 commit into
mainfrom
claude/avatar-animated-freeze
Jun 30, 2026
Merged

fix(avatar): freeze APNG and animated WebP avatars, not just GIF#772
mremond merged 1 commit into
mainfrom
claude/avatar-animated-freeze

Conversation

@mremond

@mremond mremond commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #770. Animated avatars are meant to show a frozen first frame and play only on hover. #770 fixed the freeze-frame cache for virtualized scrolling, but the freeze still only ever applied to literal GIFs.

The decision "is this animated?" was made from the declared MIME type (blob.type === 'image/gif'). That misses the common real-world cases:

  • Many animated avatars are APNG or animated WebP, not GIF. WebKit animates all three in an <img>.
  • The SDK occupant-avatar path stores avatars as image/png regardless of the real format (Profile.ts hardcodes it for PEP avatars and defaults to it for vCard avatars with no <TYPE>), so even a GIF can arrive mistyped.

So these avatars were never frozen and animated continuously (observed: kuyuhi in #XSF, an animated PNG).

This detects animation from the actual image bytes instead of the declared type: GIF header, APNG acTL control chunk, or animated-WebP ANIM chunk. The existing canvas first-frame extraction already handles any decodable raster format, so the freeze now covers all three. Static JPEG/PNG/WebP are left untouched (no signature match), so there is no extra work for the common case.

Known gap

Animated AVIF/HEIF are not detected (rare as avatars, and WebKit animation support for them is limited). They would keep animating.

The freeze decided "is this animated?" from the declared MIME type
(blob.type === 'image/gif'). That misses the common real-world cases: many
animated avatars are APNG or animated WebP, and the SDK occupant-avatar path
stores avatars as image/png regardless of the real format (Profile.ts), so
even a GIF can arrive mistyped. Those avatars were never frozen and played
continuously (kuyuhi in #XSF is an animated PNG).

Detect animation from the actual image bytes instead: GIF header, APNG acTL
control chunk, or animated-WebP ANIM chunk. The canvas first-frame extraction
already handles any decodable raster format, so the freeze now covers all
three. Static JPEG/PNG/WebP are untouched (no signature match).
@mremond mremond added this to the 0.17.0 milestone Jun 30, 2026
@mremond mremond merged commit e6bd8ef into main Jun 30, 2026
3 checks passed
@mremond mremond deleted the claude/avatar-animated-freeze branch June 30, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant