GIF image drawing

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • GIF image drawing

      Hi,

      Previously i was using the systic timer and IMAGE_SetBitmap to set the GIF but the GIF drawing is slow and stops in between.
      I am able to draw GIF images using GUI_GIF_DrawSub in paint and calling WM_InvalidateArea every 25 msec with the rectangle area which is to be updated and it is working fine.
      I am looking other methods which can be used to achieve the same result but with best perfromance.

      1) use the above mentioned method
      2) use image widget and set the individual gif sub image every 25 msec. How to get the individual image pointer from the GIF's required for IMAGE_SetBitmap function
      3) use memdev for storing the getting the individual images in memory and then use GUI_GIF_DrawSub or IMAGE_SetBitmap to set the image. how do i do this?. any memdev example with GIF available? any if IMAGE_SetBitmap is used can it get the individual image pointer from the GIF array?

      My last question would be which of the above 3 methods will give maximum performance while drawing GIF's

      Thanks
      Regards,

      Anuj
    • Hi,

      you would achieve the best performance with memory devices, however, you would probably need a lot of RAM to create a device for every sub-image (depending on the image size).

      I would recommend to save and draw each sub-image as a C bitmap. Drawing the sub-images with GUI_GIF_DrawSub() won't be as efficient as drawing bitmaps, since the routine has to search the array for each sub-image every time. This means, through the end of the GIF, the routine takes longer to find the correct sub-image than at the beginning.

      Best regards,

      Florian
    • Hi,

      Thanks for your inputs.

      How do i get each sub image as a c bitmap? How do i create the .c file for each sub image?
      Is there any way to get the sub image pointer from the gif image and use image widget to draw the sub image?

      Thanks
      Regards,

      Anuj
    • Hi,

      if you convert a GIF image to a C array, you simply have to call IMAGE_SetGIF() and the GIF will be drawn automatically (all subimages and time delays).

      The best way to extract the subimages probably would be GIMP. When loading the GIF image, you may have to click "Filters -> Animations -> Unoptimize". This is because the frames in most GIFs image only contain the changes but not the full frame to achieve a lower file size.

      After the frames are unoptimized, you can export all layers by clicking "File -> Export Layers...". Then you can convert the exported images to C bitmaps using the BitmapConverter. Depending on the number of subimages, it makes sense to do this via the command line.

      Best regards,

      Florian
    • Hi,

      Thanks for your reply.
      i am familiar with GIMP and the last option would be using individual c files but wanted to know if there is any emwin api to get the images from the GIF at runtime and use IMAGE_SetGIF(). it seems there is not.

      Thanks,
      Regards

      Anuj