Skip to content

WebP support and some other stuff - #1220

Open
HeroEyad wants to merge 1 commit into
mainfrom
webp-support
Open

HeroEyad wants to merge 1 commit into
mainfrom
webp-support

Conversation

@HeroEyad

@HeroEyad HeroEyad commented Dec 2, 2026

Copy link
Copy Markdown
Member

adds support for .webp images, including animated webp, through codenamecrew's hxwebp fork (that i just forked like 2 hours ago), which builds libwebp from source.
and also libwebp updated to 1.6.0
in the build

  • added a new WEBP_SUPPORT define in project.xml, disabled for 32 bits unfortunately (vp8 specification)
  • added libwebp-dev to both linux workflows, included libwebp in shell.nix, and updated building/README.md with the deps.
  • added webp to Flags.IMAGE_EXTS after png, jpg and jpeg, so existing formats still take priority when multiple versions of the same image exist.
  • added isWebP, imageFromBytes, imageFromFile and bitmapDataFromBytes to BitmapUtil.
  • webp files are detected through their RIFF/WEBP header, or their file extension when loaded from disk. everything else continues to use lime's existing image loading.
  • hooked the new helpers into mod images, zip folder images, mod icons, window icons and the image preview in UIImageExplorer.
  • image pickers and Paths.image() can now find .webp files as well.

for animated webp

  • added animated webp support to Paths.loadFrames, which also makes it available through Paths.getFrames and FunkinSprite.loadSprite !
  • animated webp files are decoded using WebP.getAnimationFromBytes, with all frames packed into a single spritesheet !
  • frames follow the filename format (test0000, test0001, etc.), and each frame keeps its original webp duration through FlxFrame.duration !!
  • this allows animated webp to work similarly to sparrow spritesheets, with the original frame timings taking priority over the animation fps
  • using FlxSprite.loadGraphic on an animated webp will simply display its first frame

for example

var sprite = new FunkinSprite().loadSprite(Paths.image('test'));
sprite.animation.addByPrefix('idle', 'test', 24, true);
sprite.playAnim('idle');

please do note that

  • animated webp is packed into a single texture, so particularly large or long animations might exceed the gpu's maximum texture size.
  • added og credits for hxwebp.
2026-12-02.20-13-06.mp4

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