Forum

Importing GIFs

So FileTexture and DynamicTextture don’t handle GIF graphics files. Unfortunately I want to read radar images from NOAA (the US weather service), and they only serve GIFs. And yes I know, HTMLTexture can be used to render them.

BUT, if the Width and Height input pins into HTMLTexture are not right, then you get scroll bars added to the image, not nice at all.

So my question: How to get a .gif from the web, and have it always rendered into a texture without scroll bars, no matter it’s size? Bonus points if the texture size corresponds to the original size, as with FileTexture.

Thanks!

writing a quick dynamic plugin should get you some raw bytes and meta data out of a decoder, which you can feed into dynamic texture raw:
GifBitmapDecoder Class

GIF Encoder and Decoder Sample

was a good example to try out the new async/await keywords of the .NET 4.5 update. this node can load bmp, gif, ico, jpg, png, tiff and wmp images form disk or the web without blocking the vvvv main loop. please test…

TextureImageLoader.zip (1.4 MB)

Most excellent! It works! Here’s a couple of minor quirks:

The first gif (the earth) has an absolute path so it doesn’t load.

The third gif (the pigeons) stopped loading at about .17, and I had to hit reload for it to load properly. Works that way every time I start the patch.

Although this is perfect for what I needed (static images), it would be cool to get the animated gif frame timing data out as a spread of spreads as well.

Thanks tonfilm, great work! (Per usual!)

working here. Thanks

@DiMiX do you also experience that the download of the images stops at the first run of the patch and you have to hit reload? i had this here couple of times, but thought its my bad internet connection…

yes, sometimes. even with different URL
but load from harddrive working all the time

Did some more testing. Definitely problems loading with a spread of URLs. The attached patch gets a directory listing, and then tries to load all the GIFs on that page (usually about 25).

When the patch is first run, about 5 will load, but not necessarily the first ones. If you bang the reload, the first 2 or 3 will load, and banging it further results in 2 to 4 loading, and then once they all loaded after about 5 or 6 bangs. Another time it faulted (see below).

Almost there, thanks tonfilm!

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Media.Imaging.LateBoundBitmapDecoder.get_Frames()
at VVVV.Nodes.ImageLoaderSlice.d__9.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at VVVV.Nodes.ImageLoaderSlice.d__2.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__0(Object state)

NOAA_Radar.v4p (24.8 kB)

I’ve just tested Tonfilm’s imageloader with gifs.
After installing .Net 4.5, i can see animated gifs!
It’s working like DiMiX reported.

I’ve found a few gifs which are not rendered as they should.

Imageloader is not working with b32.1
Would it be possible to fix it and or make a DX11 version?

bumping this thread.
the imageloader doesn’t work with 33 aswell… i got .Net 4.5 installed
anyone got this working?

uploaded a newer version here: https://discourse.vvvv.org/