penfeizhou / APNG4Android

Android animation support for APNG & Animated WebP & Gif & Animated AVIF, High performance
Apache License 2.0
572 stars 75 forks source link

WebPEncoder overlays all Frames #95

Closed AaronMaria closed 3 years ago

AaronMaria commented 3 years ago

It works in creating the animated WebP, but each Frame seems to include all previous Frames. Can you tell me if I did something wrong, here is a snippet:

  drawable = ApngDrawable.decode(getInputStream(uri))
  val encoder = WebPEncoder()
  for (frameNum in 0 until drawable.frameCount) {
      drawable.seekToFrame(0, frameNum)
      var frame = scaleToAlternative(drawableToBitmap(drawable.current)!!, 512, 512, 16)
      encoder.addFrame(frame, 0, 0, drawable.frameDurations[frameNum])
  }
  createFile(encoder.build(), path)

I try to create an animated WebP from an APNG.

AaronMaria commented 3 years ago

I got it, disposal seems to be off by default

penfeizhou commented 3 years ago

Yes,it's a simple translation. If you need more adavanced usage for better performance or compression,please see https://developers.google.com/speed/webp/download.