I personally prefer Java and libgdx, which is what Spine is written in/with.
We provide an example that gets you close:
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:
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.
PngExportTest for you, which writes animation frames to an FBO then to PNG files:
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.