davidmz / apng-canvas

APNG implementation on canvas.
https://davidmz.github.io/apng-canvas/
MIT License
668 stars 93 forks source link

How about making an encode lib? #27

Closed Marckon closed 3 years ago

Marckon commented 3 years ago

Great works! I learned a lot from this lib. Right now, I am trying to make apng from a png list. However, I encountered some problems. I would like to know your implement, could you enlighten me?

ray007 commented 3 years ago

I had the same requirement a while ago, feel free to take a look at https://github.com/ray007/apng-as.js

Marckon commented 3 years ago

@ray007 good work, but the code is hard to understand. Could you tell me If I just put 4 bytes of sequence number ahead of IDAT chunk to make it as an fdAT chunk then assemble them to an apng, why is this apng broken? Does IDAT chunk needs more treatment?

ray007 commented 3 years ago

Sorry, I put in enough effort to get the assembling working a couple years ago, but I do not know enough about png to answer your question.

Marckon commented 3 years ago

I know what I did wrong:

  1. fcTL should share sequence number with fdAT
  2. pay attention to img width and frame width.( I set the dimension wrong)

For the following, I used the same thoughts with author to write an encode approach. See here: apng-handler