This function saves out a GIF animation.
You supply the GIF index (as returned by the function gif_open) as well as a filename to save it with. Note that GameMaker does not automatically append the .gif file extension, so you should include this as part of the filename string if you wish the saved file to be identified as a GIF. The created GIF will be palletized using the Universal 884 Palette (see here for more information).
Note that if the function is successful and the GIF is saved correctly, then it will return 0, otherwise it will return -1.
NOTE This function closes the handle to the GIF image. This means that after saving you cannot use this GIF ID again and you'll need to open a new GIF using gif_open.
gif_save(gif_index, fname);
Argument | Type | Description |
---|---|---|
gif_index | GIF ID | The ID of the GIF to save |
fname | String | The filename to use for the GIF |
if (save_gif == true)
{
if (count == 0)
{
gif_image = gif_open(room_width, room_height);
}
else if (count < 30)
{
gif_add_surface(gif_image, application_surface, 6/100);
}
else
{
gif_save(gif_image, "GameCapture.gif");
count = 0;
save_gif = false;
}
count++;
}
The above code will create a GIF image file with 30 frames taken from the application surface and then save it.