I have the following GIF image file:
I want to extract its frames (using PGM output
You can use graphicsmagick:
gm convert Test.gif +adjoin Test_image%3d.png
or
gm convert Test.gif -coalesce +adjoin Test_image%3d.png.
gm convert Test.gif -coalesce +adjoin Test_image%3d.png
Use the -coalesce option:
-coalesce
convert -coalesce brocoli.gif out%05d.pgm