Right so I have a program that can edit images and whatnot. I've managed to allow the user to save as PNG files using the PNGEncoder class from as3corelib, but I'd also like to allow the user to save images as GIF files. The problem is, the only information I can find for saving GIFs is for animated GIFs (with libraries like as3gif), but I want to save them as static GIFs.
Anybody know a library or method to do this? I'm making an AIR app using the Flex 4 SDK with FlashDevelop.
EDIT: I tried making a single-framed GIF using as3gif:
var encoder:GIFEncoder = new GIFEncoder();
encoder.setRepeat(0);
encoder.setDelay(500);
encoder.start();
encoder.addFrame(image);
encoder.finish();
imageBytes = encoder.stream;
I then went on to save the bytes using a FileStream, but it gave me an invalid GIF file. I also tried Jonatan's code but that gave the same result.
EDIT: The problem was elsewhere in my code. Encoding a gif using as3gif with a single frame gives a fully functional static gif.