How to produce animated files from RAW instances in 0.30.0?
We are upgrading Sharp from 0.2*.0 to 0.30.0 and we discovered that pageHeight property on webp() is not supported anymore.
Our use case is:
- Load animated image and extract
pageHeight - Extract frames from one tall image
- Process each frame separately
- Compose frames to one tall image
- Save as animated file by using
pageHeight
The problem is that each frame is processed by multiple steps. Before each step, new Sharp instance is created with
new Sharp({ raw: { ... } }) constructor and the previous result is piped into it.
By this, we are probably loosing some kind of metadata which tells Sharp to save image as animated.
Previously, it was easy to tell the Sharp that the result is animated as you need to provide pageHeight and everything worked as expected.
Hi Tomáš, yes, as a side effect of improved resizing/cropping of animated images, this scenario is now currently unsupported.
Thinking about the right place in the API for this, perhaps adding an animated: true option to the future possible enhancement of #1580 would make sense as that feature would be a better solution to your problem.
@lovell Great! I will try to do a PR as we will need it.
I've added a note to https://github.com/lovell/sharp/issues/1580#issuecomment-464433871 about animated: true - let's track it there.