Jump to content

Fixed copy of Midora's ImAGIF FileType plugin (v0.13)


Recommended Posts

Midora seems to have abandoned the plugin and @Pixey's been unable to reach him. This plugin doesn't work in Paint.NET 4.2 because it's using a class that's now internal. The plugin shouldn't have been doing that, and I'm not going to change my code to accommodate it.

 

So, I disassembled it, fixed the build errors, and fixed up all (hopefully) the pointer code that Reflector bungled, and here we go.

 

Please try this out and let me know if you run into any problems. If it all works out then @Ego Eram Reputo can update the original plugin page with this version.

 

Here's the plugin's actual post/page: 

 

Edited by toe_head2001
Removed download
  • Like 2
  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Spoiler

Application version: paint.net 4.2

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at PaintDotNet.Data.Quantize.Quantizer.ReplacePassWithDithering(BitmapData in32Data, List`1 lc, Int32 width, Int32 height, Int32 ditherLevel, ProgressEventHandler progressCallback) in C:\src\github\ImAGIF.FileType\PaintDotNet\Data\Quantize\Quantizer.cs:line 418
   at PropertyBasedFileTypes.ImAgifFileType.DoSave(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) in C:\src\github\ImAGIF.FileType\PropertyBasedFileTypes\ImAgifFileType.cs:line 275
   at PropertyBasedFileTypes.ImAgifFileType.OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) in C:\src\github\ImAGIF.FileType\PropertyBasedFileTypes\ImAgifFileType.cs:line 542
   at PaintDotNet.FileType.Save(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback, Boolean rememberToken) in D:\src\pdn\src\Data\FileType.cs:line 276
   at PaintDotNet.Dialogs.SaveConfigDialog.<>c__DisplayClass48_0.<UpdatePreviewAsync>b__0() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 604
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PaintDotNet.Dialogs.SaveConfigDialog.<UpdatePreviewAsync>d__48.MoveNext() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 623

 

The file I was attempting to save (attached) had one hidden layer. Deleting this layer allowed the file to save without error.

ActiveLayerDemo.zip

Link to comment
Share on other sites

Okay well, I've already put a ton of time into this and I have to move on.

 

Happy to open up the GitHub repo to anyone else if they're motivated to fix up any leftover bugs, but I can't spend any more time on this.

 

@null54? @Bruce Bowyer-Smyth? @BoltBait?

 

dnspy may be a better choice for disassembling the code. Reflector may have just garbled too much of it.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

No, not yet. @Ego Eram Reputo still has a bug with the image he was trying above ^^^

 

Could be worth making a thread in the Plugin Developer Central though. At least we can provide people with a beta.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

9 hours ago, Rick Brewster said:

Could be worth making a thread in the Plugin Developer Central though. At least we can provide people with a beta.

 

Can I move this thread?

Link to comment
Share on other sites

I simply told the plugin to skip over invisible Layers.

if (layers[i] is Layer layer && !layer.Visible)
{
    continue;
}

Seems to work around the issue that I don't completely understand.

 

Or is this plugin supposed to do something special with invisible layers? (I haven't used this plugin enough to know its "ins and outs") @Pixey , @Ego Eram Reputo, et al?

 

EDIT: this doesn't fully solve the issue.

 

Edited by toe_head2001
  • Like 1
  • Upvote 3
Link to comment
Share on other sites

I will test it tomorrow @toe_head2001 I have family staying and it's a bit hectic today.

 

As for invisible layers, as far as I can remember, if you did that you would just get an uneven rhythm in the finished .gif, -  like a flash.

 

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

I just tested this @toe_head2001.  I don't have any problems with Rick's version, that I could see. I used a pdn file from the example folder.

 

However, your version does not work unless all the layers are ticked.  I can build a working gif with the pdn file with some layers turned 'off' in Rick's version.

 

agif_plugin.png

 

Notice nine (9) layers are unchecked. The gif builds just fine, leaving the layers 'as is'.

 

With yours, the unchecked layers get skipped over. The gif still 'builds', but it isn't animated.  I had to 'check' all the layers to get the gif to build correctly.

 

If you have a lot of layers, it would be a pain to tick them all.  Just letting you know....:)

 

EDIT: And I honestly don't know what is going on with EER's example. I can't find a hidden layer. If all of them are checked, it still doesn't build.

 

 

Edited by lynxster4
  • Like 1
Link to comment
Share on other sites

1 hour ago, lynxster4 said:

The gif still 'builds', but it isn't animated.  I had to 'check' all the layers to get the gif to build correctly.

 

You shouldn't need to check all layers; you just to check at least two frame layers. You have only one checked. Foreground and background don't count as frames.

 

1 hour ago, lynxster4 said:

If you have a lot of layers, it would be a pain to tick them all.  Just letting you know....:)

 

Ok, that's a fair point.

Link to comment
Share on other sites

I can confirm it works without all layers ticked.  EER will have to confirm his issue.

 

Thanks @toe_head2001!  :)

 

Link to comment
Share on other sites

10 hours ago, toe_head2001 said:

Ok, this reverts the layer visibility change, and should fix the issue found by @Ego Eram Reputo. Please confirm.

 

ImAGIF.FileType-Test2.zip 499.04 kB · 3 downloads

 

 

This version is includes hidden layers in the animation. In the attached file there is a path layer and a black layer which were both hidden.

 

At least it completes the save :)

 

ActiveLayerDemo3.gif

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...