Encode GIF in J2ME

I have an Image object in J2ME and I would like to attach it to a GIF. I already found a JPEG and PNG encoder, but I wonder if it is possible to encode my image in GIF format by returning its byte array.

I am 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 would like to encode it in GIF, for example:

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

Where can I find him?

thank!

+3
source share
1 answer

See the J2ME Animated GIF encoder ,

Application:

The use is quite simple, and this requires the following steps:

  • Create an instance of the AnimatedGifEncoder object
  • , OutputStream (: ByteArrayOutputStream)
  • addFrame()
  • , "" ()
+3

Source: https://habr.com/ru/post/1768244/


All Articles