I personally prefer Java and libgdx, which is what Spine is written in/with.
We provide an example that gets you close:
FboTest
That renders a skeleton to a frame buffer object (FBO). You can then get the pixels and write a PNG file.
You'll need to pose your skeleton for each from throughout the animation. This example is related:
BonePlotting
That poses the skeleton at regular intervals. It doesn't render it, it just writes out bone positions, so you'll need to render to an FBO and write that to a PNG for each frame.
I've created PngExportTest
for you, which writes animation frames to an FBO then to PNG files:
PngExportTest
You'll likely have more to do for your tool. You can run through the animation without rendering, calling Skeleton getBounds
each frame to determine the maximal bounds across all frames, then create an FBO and pixmap of the right size and run through the animation again to export the PNGs. I suggest using gifski to assemble PNGs into a GIF.