Decoding error with transparent background animations
Status: Alpha
Brought to you by:
sbridewell
Please try to decode this file : http://pouet.net/avatars/yo_man2.gif
You can notice that GifDecoder.Frame[x].TheImage is not generated correctly, and, as an example, on frame 25, TheImage contains the pixel from the frame 24, and so on. ( transparents zones contains pixels from previous frames )
I don't seem to be able to download that image. Could you attach it to this bug report please?
Sorry, ignore that last comment, I see you've already attached it. I was able to download it once I realised that what I was seeing at http://pouet.net/avatars/yo_man2.gif was not a blank page, but an animation with some white pixels surrounded by transparent pixels, which wasn't visible when I had white as the default background colour. When I set my default background colour in Firefox to something other than white, I can see the animation.
Interesting... Having looked at it with GifInspector I see that the global colour table has 2 colours, and they're both white, and the first entry in the global colour table is the one which is nominated as the transparent colour.
I think the problem here is that you're trying to display something in white on a white background, unless I've missed the point completely...?
If this was a gif you made yourself with GifBuilder or AnimatedGifEncoder then maybe if you attach the original frame images you used to make it then I'd get a better idea of what's wrong.
no. i'm not trying to display something in white on a white background !
I'm just comparing the frames in the gif, and what gifdecoder return.
more colors, but same problem on that file : http://pouet.net/avatars/sucks-rot2.gif
now i will try to reproduce the problem with on of my own gif animation and post it here.
I made a new gif animation with Fireworks (that optimize and write the animated gif's with transparent backgrounds pretty well)
Here we go : http://www.sidabitball.com/hellobug.gif
(look at the animation in your browser, then compare the results with gifdecoder, it's pretty weird)
Ah, I see what you mean now. There's definitely something wrong with the way frames which make use of transparency are decoded. This will be an interesting one to get to the bottom of...
would you like more samples of wrongly decoded gif files ?
I have a lot of those :)
Yes please. Still very busy at my day job at the moment so haven't had a chance to look at this properly yet, but once I do, the more examples we've got the better.
Here is a small compilation of gif files that are badly decoded :
http://sidabitball.com/WrongGifs.rar
I just noticed that some errors come from Frame Difference Optimized files.
i think you should give a look at this page, that is very interesting :
http://www.webreference.com/dev/gifanim/frame.html
cheers
Thanks for the examples. I've downloaded them and compared how they look in a browser compared to how GifInspector displays them, and there's definitely some confusion between transparent pixels and the option to restore pixels to their previous colour (one of the features used by highly optimised GIFs).
I've also created a feature request 2955683 at https://sourceforge.net/tracker/?func=detail&aid=2955683&group_id=284670&atid=1206750 for AnimatedGifEncoder to try and do the sort of optimisation described at http://www.webreference.com/dev/gifanim/frame.html, although currently that sort of thing is the responsibility of the application which calls AnimatedGifEncoder, hence the low priority.
I've made some changes to GifFrame and also created a new test case for this bug, using some of the files you've supplied. This has all been committed to the repository in revision 81.
It looks like these files are being decoded correctly now - could you take a look and confirm please?
I have just tested (recompilation ok) but it failed, as i have a new exception in GifComponents PaletteConverter.cs when i try to look at the images (via GifDecoder)
"p is null on line 100"
Dont you have the same problem ?
I don't recognise that error message. Can you post the full message and stack trace, and a description of what you were doing when it happened please?
I guess there's probably a file missing from the repository.
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="GifComponents"
StackTrace:
at GifComponents.Palettes.PaletteConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destType) in C:\Documents and Settings\Acer\Desktop\gifcomponents\GifComponents\Palettes\PaletteConverter.cs:line 100
at System.ComponentModel.TypeConverter.ConvertToString(ITypeDescriptorContext context, Object value)
at System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyTextValue(Object value)
InnerException:
oh, and it happen when i click on the image tab, from the gifDecoder, when it's launched from visualStudio
So you're seeing this when building and running GifInspector from within Visual Studio? I haven't been able to reproduce this when building and running from #develop.
The line which is throwing the error says
return p.ToString();
and earlier on in the same method it says
public override object ConvertTo( ITypeDescriptorContext context,
CultureInfo culture,
object value,
Type destType )
{
Palette p = (Palette) value;
So I guess the value parameter passed to this method is null when this happens?
I'll need to dig some more in order to work out when and why the value parameter could be null, and whether this method needs to check for it being null, but in the mean time, if you could post some more exact instructions on how to reproduce this error, that would be most helpful :-)
Still unable to reproduce this error I'm afraid. So what I've done is change the ConvertTo method in PaletteConverter so that if the value parameter is null, it just returns null rather than trying to do anything with the null object.
Could you see if this solves the error please?
i'm sorry, i had no time to do some more test around it, i'll do my best to revert asap
I believe this is fixed in version 0.1.3711.28220 of the MSI installer, uploaded today, just awaiting confirmation.