Paint.NET 'PNG Images and Animations' FileType Plugin (.PNG, .APNG) +------------------------------------------------------------------------------- | Summary +------------------------------------------------------------------------------- Loads and saves[Not supported] PNGi mages and 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 informations from the file (like frame durations or comments) will be stored in the layer names after the marker '//'. [Not supported] 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. +------------------------------------------------------------------------------- | Author +------------------------------------------------------------------------------- Martin Osieka You may use this plugin together with Paint.NET w/o any restriction. +------------------------------------------------------------------------------- | Installation +------------------------------------------------------------------------------- Follow the instructions carefully - Unzip the archive - Copy the four files ImAPNG.libpng-x86.dll, ImAPNG.libpng-x64.dll, ImAPNG.FileType.dll, ImAPNG.FileType.dlc to the Paint.NET\FileTypes\ folder (a typical location is C:\Program Files\paint.net\FileTypes). - 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 APNG. +------------------------------------------------------------------------------- | Compatibility +------------------------------------------------------------------------------- Paint.NET 3.5.11 and 4.05 +------------------------------------------------------------------------------- | Supported languages +------------------------------------------------------------------------------- English, Deutsch +------------------------------------------------------------------------------- | Keywords +------------------------------------------------------------------------------- FileType, PNG, APNG, Animation +------------------------------------------------------------------------------- | Dialog Options +------------------------------------------------------------------------------- [Not supported] The save dialog allows you to select the file variant to create: - PNG Animation - PNG Image 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 of frames: see NoDups= +------------------------------------------------------------------------------- | Layer names commands +------------------------------------------------------------------------------- Commmands with preset in the save dialog: Comment=A; ASCII text only. Use this to add the crator of the file or other info. Maxcolors=N; Default is 256. DitherLevel=N; 0: No dithering, 8: Maximum. Default is 7. Threshold=N; Opaque if alpha >= N. Default is 128. Duration=N; or N ms; or M fps; Display time in milliseconds. You may also use fps (frames per seconds) which will be mapped to a duration (duration = 1000 ms / M) Cycles=N; The number of cycles the animation should be played by a viewer application. The viewer may ignore this value. The default value is 0, which means infinite. NoDups=B true: if the successor of a frame is a duplicate then this duplicate will be removed and its duration will be added to the duration of the frame false: no action The default value is true Commands to define how the layer content will be used: UseAsBackground; Set this background for all following frames up to the next background command. UseAsBackground=false; means that the following frames do not use a background UseAsForeground; Set this foreground for all preciding frames up to a previous background command. UseAsForeground=false; means that the preciding frames do not use a foreground UseAsNote; Ignore layer. The layer may be used to draw help lines. UseAsDefault; Set the image in the layer as default image. Used if the viewer does not support animations. UseAsSprite=NAME,ORIGINX,ORIGINY; Defines the layer content as a sprite with the name NAME. A sprite layer can be at any position in the layer stack. It can be referenced from other commands via NAME. Sprite names are not case-sensitive and must be unique. Don't use whitespace or any delimiters in the names. ORIGINX and ORIGINY are optional coordinates of the sprite origin (default 0,0). Other commands Draw=NAME,X,Y; Draws the sprite NAME to the frame generated from the current layer. By default the origin of the sprite will be drawn at the origin of the layer. But you can can use the optional parameters X and Y to move the draw position. 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 layer. Transition=T,V,D; Adding a transition command means that additonal frames will be generated in-between the current frame and the next one. The content of these frames depends on the transition type T an optional direction D and variant V. Direction D may be: left, top, right, bottom, topleft, topright, bottomleft, bottomright, center. Variant V may be: normal, zoom, hor, ver. Not all types support all directions or variants. The following transitions are available: Fade Alpha blends the current frame with the next frame (no direction or variant) Push,D Moves the previous and the next frame in direction D Cover,D,V Covers the previous image with the next image by moving next image in direction D. V variant (normal,zoom,hor,ver) Uncover,D,V Uncovers the next image by moving the previous image in direction D using variant V WipeIn,D,V WipeOut,D,V Blinds,D D may be hor or ver Duplicate=N,M; Duplicates the last N frames sequence M times. M is optional (default is 1) Reverse=N; Adds N frames generated up to the current layer in reverse order to the animation (not including the first and the current frame). I.e. if layer 5 has the reverse setting then you will get the frames 1 2 3 4 5 4 3 2. N is optional. If not given the revers to the first frame. +------------------------------------------------------------------------------- | How-to +------------------------------------------------------------------------------- [Not supported] Create a new animated PNG: . Select File->New - Add as many layers as you like. Use layer properties to add settings after '//' to the layer names. I.e. add "// 2000 ms" to the bottom layer name. - Select Menu->Save As... - In the 'Save As' dialog select 'APNG' as file type and enter a name. - Select OK in the -save dialog. - In Windows FileExplorer change the extension of the new file from '.apng' to '.png'. [Not supported] Edit an animated PNG: - In Windows FileExplorer change the extension of the file from '.png' to '.apng' - Open the file in Paint.NET - Continue as in 'Create a new animated PNG' +------------------------------------------------------------------------------- | How does save works +------------------------------------------------------------------------------- [Not supported] Saving of an animated png is a complex process (compared to other file types) because the image data has to be processed to create new images. Here are the steps needed to create the file: - Analyze all layer names and extract the settings (the visibility property of a layer has no impact to this procedure) - Create a list of frame images from the layers by merging the layers. next frame = 'UseAsBackground' layer (if defined) + next layer + 'UseAsSprite' layers which should be drawn to this layer + 'UseAsForeground' layer (if defined) This process respects opacity and blend mode properties of the layers. - Transition commands may create additional frames between the normal ones. - Up to this point all frames are in 32bit ARGB color. - Use the threshold to calculate opaque and fully transparent pixels. - Remove duplicate frames by adding their duration to their predecessor. - Calculate the overall amount of colors used by the frames - If the amount is larger than maxcolors then do a quantization step - calculate an optimal color table with maxcolors entries - map the existing colors of the frames to the colors in the table this may include dithering of the colors - Calculate a good disposal strategy used to store a frame in minimal size. This is a heuristic method. It is not possible to calculate always the best. - Store the frames in the file. Add the delays and comments information. +------------------------------------------------------------------------------- | History +------------------------------------------------------------------------------- 0.3 (6.4.2015) - First public test release - Only loading is supported. - The plugin uses an unmanaged dll based on libpng with apng patch plus modifications. There is a variant for 32-bit and 64-bit environments.