collect-assets icon indicating copy to clipboard operation
collect-assets copied to clipboard

Optimizer disallows animation

Open samtay opened this issue 1 year ago • 1 comments

Problem

When manganis optimizes an animated webp/avif/gif file, it appears to strip the animation to a static image.

Steps To Reproduce

Steps to reproduce the behavior:

  • Just use an animated webp: const IMG: &str = manganis::mg!("assets/animated.webp");

Expected behavior

The image should be animated.

Environment:

  • Manganis version: 0.3.0-alpha.1
  • Rust version: [rustc 1.80.1]
  • OS info: Arch Linux
  • App platform: [web, fullstack]

Questionnaire

  • [x] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

samtay avatar Aug 14 '24 14:08 samtay

You can explicitly mark an asset as a video with the video function: manganis::mg!(video("assets/animated.webp"))

manganis should try to detect videos automatically from the content. It looks like the image crate has some limited support for frames. If you are interested in working on this, we could skip re-encoding the image if it has more than one frame.

ealmloff avatar Aug 30 '24 15:08 ealmloff