0

I'm working with Embarcadero RAD Studio XE7. In this context, I'm interested to use the Windows Imaging Component (WIC) library to read and show the content of an animated GIF image.

I saw that the VCL provides a TWICImage component, which with I'm able to read easily the first frame of my animated GIF. Now I want to implement a timer to loop through all my frames and show them one by one, in order to show the complete GIF animation on my form.

Which properties the TWICImage provides to do that?

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
Jean-Milost Reymond
  • 1,833
  • 1
  • 15
  • 36
  • 1
    TWIC seems very limited. WIC has the concept of frame (so you can have multiple frames per image, which is what a GIF is), but that doesn't seem to exist in TWIC. It probably means you'll have to use WIC itself, something like what's done here: https://stackoverflow.com/questions/42225924/twicimage-how-to-set-jpeg-compression-quality – Simon Mourier Jan 05 '18 at 17:26
  • 3
    Have you considered to use the `Vcl.Imaging.GIFImg` unit and display the `GIF` image in a `TImage` with simply `(Image1.Picture.Graphic as TGifImage).Animate := True;` – Tom Brunberg Jan 05 '18 at 20:04
  • Thx for your answers. @TomBrunberg: In fact I used a GIF as an example, because it's an image kind both simple and animated, and it was exactly what I needed to illustrate. But the code I need to implement is in fact more general, it will include a more advanced usage of the WIC features, and will take care of several formats, among other the GIF. But you're right, if my purpose was really to use the GIF format I would use a TGIFImage instead. – Jean-Milost Reymond Jan 05 '18 at 20:38
  • Read the docs for WIC – David Heffernan Jan 06 '18 at 15:49
  • This is the problem. The TWICImage documentation says nothing about the question I posted above. Also, and as Simon Mourier says above, I seen several postst mentionning that the TWICImage is strongly limited, and I need to determine if this component can serve for my purposes. My question isn't about the WIC capabilities (anyway I know how to reach my goal by using the WIC directly). What I want to know is if the TWICImage supports the specific properties I need, in order to determine if I must implement my own wrapper around WIC, or if I can use the currently existing TWICImage component. – Jean-Milost Reymond Jan 08 '18 at 12:36
  • 1
    See [this sample](https://code.msdn.microsoft.com/windowsapps/Windows-Imaging-Component-65abbc6a) – Chuck Walbourn Jan 24 '18 at 06:33

1 Answers1

0

So, as the VCL TWICImage component seems strongly limited, and as I cannot reach my goals using it, I decided to write my own wrapper around the WIC library.

For those who would encounter the same difficulty, I also advise you to implement your own wrapper, it is not such a difficult task.

It's a shame for the TWICImage component, but unfortunately it seems to have been sloppy.

Thanks for all the above replies.

Jean-Milost Reymond
  • 1,833
  • 1
  • 15
  • 36