Jump to content

midora

Members
  • Posts

    1,782
  • Joined

  • Last visited

  • Days Won

    26

Posts posted by midora

  1. 'GIF Animations and Images' FileType Plugin (.GIF, .AGIF)


    Download

    Find the latest version of the plugin here: ImAGIF.FileType v1.5.zip [2021-11-16]

    Thumbnail support for .agif file type: ImAGIF.Thumbnail v1.0.zip [2021-11-18]

    Installer for ImAGIF.Thumbnail: ImXYZ.Thumbnail.dll Installer v1.0.zip [2021-11-18]

    Some example .pdn files used to create simple animated gifs: ImAGIF.Examples v1.0.zip

     

    Summary

    Loads and saves GIF animation files. Animated images contain a sequence of images called frames which a viewer application can show as an animation.

     

    On load the plugin loads all frames from the file and adds them as layers to a new Paint.NET document. Frame 1 will become the bottom layer and so on. Some information from the file (like frame duration or comments) will be stored in the layer names after the marker '//'.

     

    On save the plugin will convert all layers to frames respecting the information found after the marker '//' in the layer names. The plugin does its best to reduce the size of the final file. The size depends on various settings.

     

    Animated GIF file format restrictions

    • Maximum number of colors is 256 (transparency count as one color)
    • No alpha transparency. Only opaque and fully transparent colors are possible

     

    See also

    'WEBP Animations and Images' FileType Plugin

    'PNG Animations and Images' FileType Plugin

     

    Keywords

    FileType, GIF, AGIF, Animated GIF, Animation

     

    Author / Copyright

    Martin Osieka

    2014-2021, Martin Osieka, Switzerland
    You may use this plugin together with Paint.NET w/o any restriction.

     

    Installation

    Follow the instructions carefully

    • Unzip the archive
    • Copy the folder ImAGIF.FileType together with its content (ImAGIF.FileType.dll/.dlc/.deps.json) into the FileTypes folder of paint.net. The location of the FileTypes folder depends on the installed variant of paint.net.
    • To avoid conflicts with other filetype plugins which support the same extension you should remove or disable them (i.e. AnimGIF.dll).

    To verify the installation you should restart Paint.NET and check that in the filetype popup of the open file selector dialog is an entry starting with AGIF.

     

    Compatibility

    Paint.NET >= 4.3.2

     

    Supported languages

    The language used in the plugin depends on the language setting of Paint.NET and the support of this language by the plugin. The fallback is the first supported language of the plugin. Languages are defined in the .dlc files. This plugin supports the following languages in the moment:

    • English

    • Deutsch

     

    Tutorials

    @Pixey Make an animated gif with Midora's Plugin

     

    'Save dialog' options

     

    2021-11-16-Im-AGIF-File-Type-Save-Dialog                                  

    The options on the top allow you to define and test the basic type of the image:

    • File variant:
      • GIF Animation
      • GIF Image
    • Preview button:
      Only enabled if the file variant is GIF Animation. Creates a temporary file containing the animation and plays the file in a preview window. Right click the preview window to get a context menu containing several commands.
      As long as you do not close the 'Save Configuration' dialog with OK the original file is still intact.
      So this feature allows you to test your animation without saving to a file.

     

    Depending on the variant you can define some initial settings in the dialog. Initial means that they will be  redefined if the related commands are used in the layer names.

    • Comment: see Comment=
    • Maximum number of colors: see MaxColors=
    • Dithering level: see DitherLevel=
    • Threshold: see Threshold=
    • Frame duration: see Duration=
    • Cycles: see Cycles=
    • Remove duplicates from frames: see NoDups=

     

     

     

     

     

     

     

    'Load dialog' options

    None

     

    Commands defined in the layer names

    See ImAGIF.FileType.ReadMe.txt

     

    How to create/edit an animated GIF

    See ImAGIF.FileType.ReadMe.txt

     

    Credits

    Rick Brewster for the Octree Quantization implementation used to reduce the amount of colors.

     

    History

    • 1.5 [2021-11-16]
      - Fixed a bug regarding the offset of sub frames (introduced in 0.13.2)
      - Added simple preview
    • 1.4 (6.11.2021)
      - Created a new topic in the 'FileType Plugins' section (old topic is Animated Images)
      - Updated code to support paint.net 4.3.2 (replaced obsolete and deprecated methods)
      - Shifted the version number from 0.13 to 1.4
      - Prepared for future improvements

    • 0.13 (12.7.2019)
      - Rick Brewster
        This plugin didn't work with Paint.NET 4.2 because it used a class that's now
        flagged "internal". This has been fixed in v0.13.

    • 0.12 (17.8.2015)
      - Fix to handle GIFs containing corrupted XMP metadata

    • 0.11 (6.4.2015)
      - Added switch to create non-animated GIFs from flattened layers
      - Added support to load true color gifs (save is disabled, because most
        viewers are not able to view them correct and Animated GIFs are not able to
        support true color).
      - Added 'NoDups' command (default: true) and dialog option.

    • 0.10 (3.4.2015)
      - Added some initial options to the save dialog. These options will be
        overridden if their related commands are used in the layer titles.

    • 0.9 (2.4.2015)
      - Added "Duplicate=N,M" command, which duplicates the last N frames sequence
        M times. M is optional with a default value of 1.
      - Added optional origin coordinates to the sprite command. "sprite=NAME,X,Y"
      - Added "DitherLevel=N" 0 <= N <= 8, default is 7.
        Dithering is used in low color filetypes to avoid banding of colors.
        The advantage of dithering is a better quality of the final image.
        The disadvantage is that the file size may increase.
      - Changed the definition of background and foreground command a bit to allow
        to switch off usage of a background and foreground and not just to replace it.
      - Declared the command names background, foreground, default, skip, and sprite
        as depreciated. The new names are:
        UseAsBackground, UseAsForeground, UseAsDefault, UseAsNote, UseAsSprite
        The prefix UseAs indicates that the layer will not create a new frame.
      - N fps (frames per second) is allowed now to define the duration.

    • 0.8 (30.3.2015)
      - Removes duplicates (frames with the same content as the previous one)
        by removing the frame and incrementing the duration of the previous frame.
      - Because some image hosters deliver html code in a gif file instead of an
        image the filetype throws now a more descriptive exception on load of a GIF:
        "File contains an HTML document but not a GIF image"
      - Added two commands which allow to animate sprites on frames
        "sprite=NAME" defines the layer content as a sprite with the name NAME.
        A sprite layer can be drawn at any position in the layer stack.
        Sprite names are not case-sensitive and must be unique. Don't use
        whitespace or any delimiters in the names.
        "draw=NAME,X,Y" draws the sprite NAME to the frame generated from the current
        layer. X and Y are optional and define how much pixels the sprite should be
        moved (default: no move). Multiple 'draw' commands are allowed in a layer name.
        The sprite layer should be transparent because the content will be blended
        on top of the current frame.

    • 0.7 (26.3.2015)
      - fixes an issue on XP and some Win7 installations where cloning of the bitmaps
        provided by the layers will return the original ones. So the filetype
        may corrupt the layer content in version 0.6.
      - added optional parameter to the 'reverse' command to define the number of
        frames to reverse.
      - added transition 'Blinds=D' (D may be hor or ver)
      - '://' sequences are allowed now in comments because this sequence is needed
        for URLs (all other '//' sequences will be removed from comments because
        they are used to start a command sequence in the layer names)

    • 0.6 (21.3.2015)
      - New setting 'GIF'. Will be added to the first layer on load (just a hint for
        other tools about the source of the layers).
      - New setting 'reverse'. Adds all frames generated up to the current layer in
        reverse order to the animation (not including the first and the current frame)

    • 0.5 (17.3.2015)
      - added 'default' setting. Not used by agif, has the same effect as 'skip'
      - added transition=T,V,D comamnd to create additional frames in-between existing
        ones.

    • 0.4 (14.3.2015)
      - A basic quantization variant is working
      - maxcolors=N; may be used to reduce the colors, default is 256; minimum is 8
      - Added 'Animating in paint.net is easy.pdn' to demonstrate usage of background
        and foreground.

    • 0.3 (12.3.2015)
      - First public test release

       

     

     

    • Like 2
    • Upvote 4
    • You're a Smart Cookie! 1
  2. No idea, why all these targets (i.e. WIA) are included.

     

    ImZIP.FileType.deps.json:

     

    Spoiler

    {
      "runtimeTarget": {
        "name": ".NETCoreApp,Version=v5.0",
        "signature": ""
      },
      "compilationOptions": {},
      "targets": {
        ".NETCoreApp,Version=v5.0": {
          "ImZIP.FileType/1.4.0": {
            "dependencies": {
              "PaintDotNet.Base": "4.303.7965.39135",
              "PaintDotNet.Core": "4.303.7965.39135",
              "PaintDotNet.Data": "4.303.7965.39135"
            },
            "runtime": {
              "ImZIP.FileType.dll": {}
            }
          },
          "PaintDotNet.Base/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Base.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "PaintDotNet.Core/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Core.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "PaintDotNet.Data/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Data.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "Newtonsoft.Json/13.0.0.0": {
            "runtime": {
              "Newtonsoft.Json.dll": {
                "assemblyVersion": "13.0.0.0",
                "fileVersion": "13.0.1.25517"
              }
            }
          },
          "Crc32.NET/1.0.0.0": {
            "runtime": {
              "Crc32.NET.dll": {
                "assemblyVersion": "1.0.0.0",
                "fileVersion": "1.2.0.5"
              }
            }
          },
          "PaintDotNet.SystemLayer/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.SystemLayer.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "CommunityToolkit.HighPerformance/7.0.0.0": {
            "runtime": {
              "CommunityToolkit.HighPerformance.dll": {
                "assemblyVersion": "7.0.0.0",
                "fileVersion": "7.0.3.1"
              }
            }
          },
          "PaintDotNet.Framework/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Framework.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "TerraFX.Interop.Windows/10.0.20348.0": {
            "runtime": {
              "TerraFX.Interop.Windows.dll": {
                "assemblyVersion": "10.0.20348.0",
                "fileVersion": "10.0.20348.0"
              }
            }
          },
          "Interop.WIA/1.0.0.0": {
            "runtime": {
              "Interop.WIA.dll": {
                "assemblyVersion": "1.0.0.0",
                "fileVersion": "1.0.0.0"
              }
            }
          },
          "PaintDotNet.Plugins.Compatibility/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Plugins.Compatibility.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "PaintDotNet.SystemLayer.Native.x64/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.SystemLayer.Native.x64.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "System.Private.CoreLib/5.0.0.0": {
            "runtime": {
              "System.Private.CoreLib.dll": {
                "assemblyVersion": "5.0.0.0",
                "fileVersion": "5.0.1121.47308"
              }
            }
          },
          "PaintDotNet.Resources/4.303.7965.39135": {
            "runtime": {
              "PaintDotNet.Resources.dll": {
                "assemblyVersion": "4.303.7965.39135",
                "fileVersion": "4.303.7965.39135"
              }
            }
          },
          "System.Windows.Forms.Legacy/0.1.1.0": {
            "runtime": {
              "System.Windows.Forms.Legacy.dll": {
                "assemblyVersion": "0.1.1.0",
                "fileVersion": "0.1.1.0"
              }
            }
          }
        }
      },
      "libraries": {
        "ImZIP.FileType/1.4.0": {
          "type": "project",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Base/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Core/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Data/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "Newtonsoft.Json/13.0.0.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "Crc32.NET/1.0.0.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.SystemLayer/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "CommunityToolkit.HighPerformance/7.0.0.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Framework/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "TerraFX.Interop.Windows/10.0.20348.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "Interop.WIA/1.0.0.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Plugins.Compatibility/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.SystemLayer.Native.x64/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "System.Private.CoreLib/5.0.0.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "PaintDotNet.Resources/4.303.7965.39135": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        },
        "System.Windows.Forms.Legacy/0.1.1.0": {
          "type": "reference",
          "serviceable": false,
          "sha512": ""
        }
      }
    }

     

     

  3. What shall I say, I stated more than once in the last months that the last decision on all things related to paint.net is on you. But this does not mean that we are sharing always the same opinion about sw development. And in addition if you don't like the idea behind OBL then this is fine.

     

    Remember that I tried to contact you beginning of the year to discuss OBL related things and solutions but you were busy in moving to a new location and later with the 4.3 update.

     

    OBL is a typical project which must be hosted on git to allow others to continue the work (in case of some kind of break 😉 ). But for this the base must be stable enough. That's the only reason for no ETA. I'm using it as a shared source project in the moment.

     

    I see no easy solution for the plugins you removed (and there are many more sharing the same issue) and there is no proposal which fits to the current set of rules. Again we are talking about old stuff. I didn't publish something which doesn't follow the rules in the last 6 years.

     

    As far as I remember all reflection related code has no effect to the workflow of users because it's inactive. It was only active on my computer. So if it breaks its just breaks on my computer. No issue for the users the plugin continues to work as before. No additional work on your side.

    It was just easier to use one version of the plugins (instead of private variants) because there was no risk that users and me are using different variants.

     

    In some way your are more relaxed in enhancements now than 6 years ago. I.e. I asked now to get access to the dpi value of the image and you added it. I asked this twice in the past and I was not able to get it. So I added reflection code in the inactive code area to extract it. But the plugins always asked the user to enter the dpi value. Just the inactive code skipped this request to improve my workflow.

     

  4. 59 minutes ago, BoltBait said:

    The simple solution is for Midora to publish a build of the plugin that doesn't have that hidden command.

     

    But this would violate the rules

     

    On 12/15/2008 at 9:44 AM, Rick Brewster said:

    When a new plugin or a new plugin update is published, it must work on the latest public/stable release of Paint.NET. 

     

    BTW: Because the first entry in 'Rules for plugins that are published on this forum' is work in progress I can only reference

      

    On 1/23/2016 at 8:20 PM, Rick Brewster said:

    New rule added to clarify this. see also: http://forums.getpaint.net/index.php?/topic/107032-tile/#entry511100

     

    Quote
    Plugins must not use reflection to reach into Paint.NET's internals.

     

    Means this rule has been added years after the plugin has been published and I wasn't active at this time.

    Maybe there was a 'should not use reflection rule' in 2014.

     

    Sorry but there is no quick solution. OBL is work in progress and there is no ETA.

     

     

     

     

  5. Rick, we are talking about plugin versions which are older than 5 years. OBL was used by others before a final version has been published (because of my break). I totally accept your rules and that you are enforcing them now stronger than earlier. I didn't publish anything which was against the rules since I returned beginning of the year. So it's a little bit unfair to attack me about this old stuff.

     

    But if you think there is no value in my work than block me and remove the old stuff. It will not hurt me. I'm just asking myself why you are so angry. But OK. Sometimes we may have a different opinion about sw development but that's nothing unusual between developers. Maybe you are just frustrated about the amount of work to get all these old plugins to run. Let them die and remove the threads if its too much work and no fun for you.

     

    Maybe you should also have in mind that English is not my native language. So if I'm using the word 'force' it may have a little bit different semantic. I just used it to explain that - against mentioned in the plugin documentation - paint.net no longer allows you to place OBL in the paint.net root (which worked with older paint.net versions and nobody complained in all the years). If you had complained 5 years ago I would have changed it at this time.

     

    I'm not sure why inactive code should harm paint.net but if you care about this then for sure I will not use it in newer plugins. There are other solutions to reach the same effect for my private workflow. It's not true that I didn't ask for an other solution using a shared library.

     

  6. Pretile_modenew ReadOnlyBoundToNameValuesRule(PropertyNames.Points, false,
                            (PropertyNames.Use_clipboard_as_tile, true),
                            (PropertyNames.Pretile_mode, Pretile_modeOptions.mode1),
                            (PropertyNames.Mode, Pretile_modeOptions.mode4),
                            (PropertyNames.Mode, Pretile_modeOptions.mode5)

  7. @MJW told the correct story ;-).

     

    Maybe try to do it step by step and write down the condition first.

     

    Too make it simple let's assume Pretile_mode can take the values mode1, mode2, mode3, mode4, mode5. mode2 and mode3 are the modes which should allow active.
        
    Points.enabled =     (!Use_clipboard_as_tile && ((Pretile_mode == mode2) || (Pretile_mode == mode3))

     

    You have to negate the condition to set the Readonly property of Points.

     

    Points.Readonly =     ! (!Use_clipboard_as_tile && ((Pretile_mode == mode2) || (Pretile_mode == mode3))

     

    Simplify the condition

     

    Points.Readonly =     Use_clipboard_as_tile || ! ((Pretile_mode == mode2) || (Pretile_mode == mode3))

    Points.Readonly =     Use_clipboard_as_tile || ((Pretile_mode != mode2) && (Pretile_mode != mode3))

     

    ReadOnlyBoundToNameValuesRule can only handle OR, so enumerate all modes which are not 2 or 3

     

    Points.Readonly =     Use_clipboard_as_tile || ((Pretile_mode == mode1) || (Pretile_mode == mode4) || (Pretile_mode == mode5))

     

     

     

  8. The new variant of the project file doesn't contain references to the files contained in the project folder. That's the main reason why the old one is much larger.

     

    My snippet doesn't contain references to all paint.net dlls. So you have to add the ones missing in your project (manually by editing the file or via right click to SolutionExplorer/dependencies).

     

    You should try to resolve all warnings (beside of this WindowsBase version conflict).

     

×
×
  • Create New...