GithubHelp home page GithubHelp logo

avalonia.gif's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avalonia.gif's Issues

Loading a GIF via a File or URL stream results in InvalidGifStreamException

Hi,

So I'm trying to load GIF images over URL and File streams and I keep getting InvalidGifStreamException("Not a GIF stream."); exceptions.

Sample code:

var imgStream = File.OpenRead(imageName);
_gifImage.SourceStream = imgStream;

Test GIF
https://github.com/AvaloniaUI/Avalonia.GIF/blob/master/AvaloniaGif.Demo/Images/c-loader.gif

Been Compiling with .NET Core 3.1

Will GIF streams from these sources (and potentially more) be supported?

Source binding issue

image
There is no problem with the demo running, why am I changing to directly bind resources and cannot use them.
Where did I go wrong?

Unable to parse URI

whats the correct way to use gifs inside my Assets folder ?, because this doesnt seem to work while other resources work fine
image

Add support for static images

If a static image (e.g. png or jpeg) is loaded, a InvalidGifStreamException (Not a GIF stream.) is thrown.

Instead of throwing an exception, it should just display a static image.

Publish as nuget package

Would love to see this published as a nuget package (at least until support is native in Avalonia)

MissingMethodException Thrown

A missing method exception is thrown when using the library. I'm using the RC1 branch:

    <gif:GifImage
            Width="300"
            Height="300"
            SourceUri="avares://My App/Assets/Images/Logo.gif" />

This is the error:

System.MissingMethodException: 'Method not found: 'Void Avalonia.Rendering.Composition.CompositionVisual.set_Size(System.Numerics.Vector2)'.'

When using SourceUriRaw, the exception is thrown everytime meanwhile SoureUri only throws the exception when the avalonia resource has been found.

Frame delay issue

A last frame delay seems to be ignored.

Input Image:

all_background

Expected act: As Above

Actual act:

Actual

Performance optimization

Hello. I'm using your library in my Avalonia project and I stumbled upon an optimization problem. I need to display many gifs from the same file. Displaying around 10-20 gifs is fine, but when i try 50+, my CPU usage rises tremendously. Do you have any advice on how to overcome this problem?

Various crashes when changing streams

I'm working on getting a consistent exception, but it seems like this fails in various ways from hard hanging visual studio when running it under a debugger to segfaults when running it on linux and others. I'll update this if I get more solid exceptions, but in general I believe there is something wrong with the 'changing' of streams. (I'm guessing something in here possibly, but not sure: private static void SourceChanged(AvaloniaPropertyChangedEventArgs e)

I tried adding:
if ((image.gifInstance != null) && (image.gifInstance.Stream != null))
{
image.gifInstance.Stream?.Close();
image.gifInstance.Stream?.Dispose();
}

to see if I could clean up streams I was using..when I'd close the stream on the outside I'd often get exceptions because the stream was in use in the animated gif control. (if there's a way to stop it that may help me).

I also tried just removing the control and then recreating it, but I don't think that was working either...I was simply removing it from the logical tree, so probably leaking controls.

I've been able to repro it with the demo app by simply using the arrow keys and going up and down fairly quickly to force the stream to change. I full screen the app, not sure if that's helpful.. Eventually the app shuts down and visual studio doesn't always catch it.

In my use case I'm making a full screen digital picture display (Dynaframe) that currently shows images and videos. I've had alot of people ask me to play animated gifs as well, so trying to get that in. When it works it's beauitful, I can crossfade the gifs. But on my raspberry pi I get a segfault within about an hour and a half, and on my windows PC I get a crash after 6 hours or so (transitioning images every 10 seconds). The memory usage doesn't climb so I don't think it's a leak, at least not one I'm seeing.

My code looks like the following: (foregroundimage and background image are image controls. gifImage is a xaml control called 'gifImage' in the xaml. ImageString is a path to an animated .gif on a system. It plays through all of the gifs several times over, so I don't believe it's a bad file.

I've reprod this on windows 10 64 bit and a raspberry pi (debian arm 32 bit) running Avalonia 10.12. I've repro'd it in my own code using file streams as well as in the demo code which uses resources.

The xaml:


<gif:GifImage x:Name="gifImage" />

The codebehind:

private void ShowAnimatedGif()
    {

        try
        {
            ImageStream = File.OpenRead(ImageString);
            ImageStream.Seek(0, SeekOrigin.Begin);
            gifImage.SourceStream = ImageStream;
            gifImage.Stretch = foregroundImage.Stretch;
            gifImage.Opacity = 1;
            foregroundImage.Opacity = 0;
            backgroundImage.Opacity = 0;
        }
        catch (Exception exc)
        {
            Logger.LogComment("Exception Rendering animated GIF: " + exc.ToString());
        }
    }

I've tried to figure it outmyself but the crash is often in the decoder code and it'll take me quite a bit to ramp up on that and the gif image format. Hoping someone with more experience in this control can repro it and help me get this working.

Huge thanks for your time and for a great control...when it works it's beautiful :)

After frame artifacts

I am getting artifacts on the image in the demo. Tail of previous frames. Can I do something about it?
image
image

Transparent background

Hi!
Does Avalonia.GIF support transparent background?
I have a turquoise background instead of a transparent background.
Screenshot_16

UPD: At the same time, a transparent background is displayed in the designer.

Project does not build

On Mar 26, #11 was merged which removed the line private readonly object _bitmapSync = new object(); in GifInstance. However, _bitmapSync is still being referenced in code

Can support apng image?

Many dynamic images are now in apng format.
I have tried to support but don't know how to overlay and render.

Is this ready for Avalonia 11? Showing RC in an open PR

I'm looking to integrate this into my current codebase as I update to Avalonia 11. Is the open PR the right branch to pull or can we please get that integrated so I can test it out? This is a big feature for the users fo Dynaframe :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.