This plugin is now depracated in favor of pure GDScript implementation by jegor377 https://github.com/jegor377/godot-gdgifexporter
Plugin adding a GifExporter singleton enabling export of Image objects as a GIF file. Currently supports Windows and Linux, both 32 and 64 bit.
- Clone this repository into your Godot projects addons folder - GDNative builds are already included in the repository.
- Enable this plugin in Project Settings.
- A new node
GifExporter
will now become available.
First create a new instance of GifExport node. Then you can call these methods:
- Starts gif export:
GifExporter.begin_export(filename: String, width: int, height: int, frame_delay: float, loop_count: int = 0, bit_depth: int = 8, dither: bool = false) -> bool
- filename - full path with a filename ('/home/user/anim.gif')
- width, height - default frame dimmensions
- frame_delay - default delay between animation frames
- loop_count - how many times is animation repeated - 0 is infinite
- bit_depth - default frame color bit depth
- dither - default apply dithering algorithm to frames
The function returns false if it's called on an unsupported platform, true otherwise.
- Adds a frame to gif:
GifExporter.write_frame(frame : Image, background_color : Color, frame_delay : float, bit_depth : int = 8, dither : bool = false)
- frame - Godot::Image object to write to file
- background_color - GIF don't support transparency - background color is applied as the background layer
- frame_delay - delay of this frame
- bit_depth - bit depth of this frame
- dither - apply dithering algorithm to frame
- Finish gif exporting:
GifExporter.end_export()
- Init and compile godot_cpp submodule
- Linux target uses GCC by default
scons platform=linux generate_bindings=yes target=release bits=32
scons platform=linux generate_bindings=yes target=release bits=64
- Windows target requires mingw32 (on Arch in AUR as mingw-w64-gcc package)
scons platform=windows generate_bindings=yes target=release bits=32
scons platform=windows generate_bindings=yes target=release bits=64
- Compile gifexporter
- I assume all prerequisities from the previous step are installed
scons p=x11 bits=32
scons p=x11 bits=64
scons p=windows bits=32
scons p=windows bits=64
- Windows libraries in bin/win have to have their suffix changed to .dll
- Strip all resulting binaries of symbols with
strip
tool to greatly reduce size (godot-cpp seems to include a lot of symbols even in the release build)
- This plugin uses https://github.com/fyngyrz/gifanimcplusplus
- Added includes of
cstding
andcstring
libraries togifanim.h