3

I have an Image object in J2ME and I'd like to enconde it to GIF. I've already found a JPEG and PNG encoder as well, but I'm wondering if it's possible to encode my Image in the GIF format, returning it's byte array.

I'm doing something like this:

...

  Image img = Image.createImage(width, height);
    Graphics graphics = img.getGraphics();
//do some drawing stuff here
...  

And finally I have an Image object.

Now I'd like to encode it to GIF like:

 byte[] gifBytes = GIFEncoder.encode(img);

Where can I find one?

thanks!

gnat
  • 6,213
  • 108
  • 53
  • 73
Eduardo Abreu
  • 245
  • 2
  • 3
  • 9

1 Answers1

3

See J2ME Animated GIF encoder,

Usage:

Usage is quite straightforward, and it requires these steps:

  • Instantiate your AnimatedGifEncoder object
  • Start it, by passing an OutputStream as argument (e.g.: a ByteArrayOutputStream)
  • Add your Image objects by using addFrame() method
  • Finalize it by calling finish()
jmj
  • 237,923
  • 42
  • 401
  • 438