Paint.NET image

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(lazpaint can open these http://alanhorkan.livejournal.com/61645.html)
m (fixing binaryformatter security guide url)
 
(One intermediate revision by one user not shown)
Line 5: Line 5:
 
}}
 
}}
 
'''Paint.NET image''' (or '''PDN''') is the native graphics file format of the Paint.NET image editor for Microsoft Windows.
 
'''Paint.NET image''' (or '''PDN''') is the native graphics file format of the Paint.NET image editor for Microsoft Windows.
 +
 +
== Format ==
 +
A PDN file mainly consists of .NET serialized data, which reflects the <code>Document</code> class in Paint.NET's C# code. Because of this, parsing a PDN file requires either parsing the .NET binary format, or if you're in a .NET environment, simply including some of the Paint.NET .dll files in your project and letting .NET do the rest (although [https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide Microsoft advises against it]).
 +
 +
There seems to be two versions of the PDN format; the older one simply compresses the .NET data through [[Gzip]]. The current one features its own file format signature, the ASCII characters "<code>PDN3</code>", as well as some metadata (width, height, thumbnail) in [[XML]] format, prefixed with its length as a little-endian 24-bit integer. The .NET serialized data can still be compressed, but it's now optional, denoted by the {{magic|0x1F 0x8B}} prefix for Gzip compression, or {{magic|0x00 0x01}} for uncompressed.
 +
 +
Bitmap data is stored as BGRA, and can be optionally serialized separately from the .NET data if its respective layer declares that the bitmap data is deferred. If so, bitmap data shows up right after the .NET data, optionally Gzip compressed. Deferred data is ordered based on the layer ordering.
  
 
== Identification ==
 
== Identification ==
Files begin with a signature: the ASCII characters "<code>PDN3</code>".
+
Files begin with a signature: the ASCII characters "<code>PDN3</code>". The older version of the PDN format starts with the [[Gzip]] signature bytes, {{magic|0x1F 0x8B}}.
 +
 
 +
== Specifications ==
 +
* [https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-NRBF/%5bMS-NRBF%5d.pdf .NET Binary Format Data Structure]
 +
* [https://github.com/rivy/OpenPDN/blob/cca476b0df2a2f70996e6b9486ec45327631568c/src/Data/Document.cs Source code for the Document class in C#]
 +
* [https://web.archive.org/web/20051230140736/http://blogs.msdn.com:80/rickbrew/archive/2005/01/18/355571.aspx Information on the first version of the PDN format]
  
 
== Software ==
 
== Software ==
 
* [http://www.getpaint.net/ Paint.NET official site] (which, confusingly enough, isn't actually at '''paint.net''' itself, which belongs to an actual paint company!)
 
* [http://www.getpaint.net/ Paint.NET official site] (which, confusingly enough, isn't actually at '''paint.net''' itself, which belongs to an actual paint company!)
 
* [http://wiki.freepascal.org/LazPaint Lazpaint]
 
* [http://wiki.freepascal.org/LazPaint Lazpaint]
 +
* [https://www.irfanview.com/ IrfanView]
  
 
== Links ==
 
== Links ==
 
* [[Wikipedia:Paint.NET|Wikipedia: Paint.NET]]
 
* [[Wikipedia:Paint.NET|Wikipedia: Paint.NET]]

Latest revision as of 15:48, 12 November 2023

File Format
Name Paint.NET image
Ontology
Extension(s) .pdn

Paint.NET image (or PDN) is the native graphics file format of the Paint.NET image editor for Microsoft Windows.

Contents

[edit] Format

A PDN file mainly consists of .NET serialized data, which reflects the Document class in Paint.NET's C# code. Because of this, parsing a PDN file requires either parsing the .NET binary format, or if you're in a .NET environment, simply including some of the Paint.NET .dll files in your project and letting .NET do the rest (although Microsoft advises against it).

There seems to be two versions of the PDN format; the older one simply compresses the .NET data through Gzip. The current one features its own file format signature, the ASCII characters "PDN3", as well as some metadata (width, height, thumbnail) in XML format, prefixed with its length as a little-endian 24-bit integer. The .NET serialized data can still be compressed, but it's now optional, denoted by the 0x1F 0x8B prefix for Gzip compression, or 0x00 0x01 for uncompressed.

Bitmap data is stored as BGRA, and can be optionally serialized separately from the .NET data if its respective layer declares that the bitmap data is deferred. If so, bitmap data shows up right after the .NET data, optionally Gzip compressed. Deferred data is ordered based on the layer ordering.

[edit] Identification

Files begin with a signature: the ASCII characters "PDN3". The older version of the PDN format starts with the Gzip signature bytes, 0x1F 0x8B.

[edit] Specifications

[edit] Software

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox