PDN File Documentation
Summary
A .pdn file is a Paint.NET image, the native document format of Paint.NET, the free image editor for Windows. Like Photoshop’s PSD, it preserves layers, blend modes and transparency, so it is a working file rather than a finished picture. Its MIME type is image/x-paint-net. Open it in Paint.NET (Windows only); to use the image elsewhere, open it and Save As to .png or .jpg. There is no reliable Paint.NET viewer for macOS or Linux, so those users usually need the file exported first.
Technical details
| Feature | Value |
|---|---|
| Full name | Paint.NET Image |
| File extension | .pdn |
| MIME type | image/x-paint-net |
| Format type | Layered raster image (native working document) |
| Developer | Rick Brewster / dotPDN LLC |
| Introduced | 2004 (Paint.NET 1.0); current PDN3 format |
| Compression | Lossless; body optionally Gzip-compressed |
| Platform | Windows / .NET only |
| Preserves | Layers, blend modes, opacity, transparency |
| Signature (hex) | 50 44 4E 33 (ASCII PDN3) |
| Byte order | XML length prefix is 24-bit little-endian |
| Header | Length-prefixed XML (width, height, layers, thumbnail) |
| Body encoding | .NET serialized (BinaryFormatter) Document object |
| Body markers | Gzip 1F 8B or uncompressed 00 01 |
| Open standard | No — proprietary, tied to Paint.NET’s .NET classes |
| Third-party readers | Limited; pypdn (Python) parses some versions |
| Related extensions | .png, .jpg, .bmp, .psd |
| Official site | getpaint.net |
What is a PDN file?
PDN is the native document format of Paint.NET, a free raster image and photo editor for Windows. Paint.NET began in 2004 as a Washington State University student project mentored by Microsoft, and it is now maintained by Rick Brewster under dotPDN LLC. Saving in PDN is lossless, and unlike PNG or JPEG it stores the whole editable document: every layer, each layer’s blend mode and opacity, transparency, and the other working state Paint.NET holds while you edit. That makes PDN the Paint.NET equivalent of Photoshop’s PSD: the file you keep while working, and from which you export a flattened image to share.
The format is deliberately Windows-and-.NET specific, which shapes almost everything about it. The header is a small, readable XML block, but the bulk of the file is a .NET-serialized copy of Paint.NET’s in-memory document, so there is no clean cross-platform reader. If someone sends you a .pdn, opening it practically means opening Paint.NET. The sections below walk through the actual bytes: the PDN3 signature, the length-prefixed XML preamble, and the serialized body.
The PDN3 signature and the 24-bit length prefix
A modern Paint.NET file opens with a four-byte magic number: the ASCII characters PDN3, hex 50 44 4E 33, at offset 0. This identifies the file as a Paint.NET version 3 or later document; files written by very early Paint.NET releases predate this signature and use a different layout. Immediately after the signature, at offset 4, come three bytes that hold the byte length of the XML header as a 24-bit little-endian integer.
offset bytes meaning
0 50 44 4E 33 "PDN3" signature (4 bytes)
4 LL LL LL XML header length, 24-bit little-endian
7 <?xml ...?> XML header (that many bytes)
... 1F 8B / 00 01 document body: Gzip or uncompressed
Three bytes give a maximum header size of about 16 MB, far more than any real header needs; in practice the XML preamble is small. Reading it is a two-step operation a parser can do without decoding anything else: read the signature, read the three length bytes, then read exactly that many bytes of XML.
The XML header: dimensions, layer count and thumbnail
The header itself is a compact XML fragment describing the document at a glance. It records the image width and height in pixels, the number of layers, the Paint.NET version that wrote the file, and an embedded thumbnail. Because this metadata sits in plain XML right after the signature, a tool can report an image’s size, layer count and thumbnail without touching the serialized body at all. That is exactly how file browsers and lightweight readers preview a .pdn: they parse the header and stop. The heavy pixel data only matters once you actually open the document for editing.
The .NET-serialized body: BinaryFormatter and the Document class
After the XML header comes the real content, and here PDN diverges from formats like PNG or PSD that define an explicit on-disk binary layout. PDN has no independent binary specification. The body is Paint.NET’s internal Document object graph written out with .NET serialization, primarily the C# BinaryFormatter. In other words, the file is a snapshot of live .NET objects: the document, its list of layers, each layer’s pixel surface, blend mode and opacity. The byte layout is whatever BinaryFormatter emits for those classes.
This is why the format is effectively locked to Paint.NET and to .NET. To reconstruct the image, a reader has to understand and instantiate the very same classes Paint.NET uses, which a third-party program in another language cannot easily do. It also means the format can shift between Paint.NET versions as those classes change. The open-source Python library pypdn parses many older PDN files by re-implementing the deserialization, but it does not cover every version, and there is no broadly supported reader outside Paint.NET itself.
Body compression: Gzip versus uncompressed
The serialized body can be stored two ways, and a single marker distinguishes them. If the body begins with 1F 8B, it is Gzip-compressed (those are the standard Gzip magic bytes), and a reader inflates the stream before deserializing. If it begins with 00 01, the body is stored uncompressed and is deserialized directly. Compression is lossless in both cases; it only affects file size, not the pixels. This is why a layered PDN with large flat regions can be considerably smaller than a naive dump of its pixel surfaces would suggest.
Layers, blend modes and why PDN is bigger than a PNG
The point of PDN is that it keeps the document editable, and that is stored as a stack of independent layers. Each layer carries its own full-resolution pixel surface with a per-pixel alpha channel, plus its own opacity and blend mode (Normal, Multiply, Screen and so on). Paint.NET composites these top to bottom to produce what you see on screen, but the file retains them separately so you can move, hide, re-order or re-edit any one of them later.
That is the direct reason a .pdn is larger than a PNG of the same picture. A PNG holds one flattened set of pixels; a PDN holds every layer plus its blending metadata, none of which survives flattening. It also explains a useful signal about the format: when an image is a single layer, Paint.NET defaults to offering PNG on save, so choosing PDN specifically indicates a multi-layer working file. Exporting to PNG or JPEG flattens the stack into final pixels and discards the editable structure, which is the expected trade when you produce a shareable image.
Reading a PDN outside Paint.NET
Because the body is tied to Paint.NET’s .NET classes, the realistic options for a .pdn on a non-Windows machine are limited. GIMP and Photoshop do not read PDN natively. The dependable route is to open the file in Paint.NET on Windows and export to a standard format, or to run Paint.NET in a Windows virtual machine. Developers who only need to extract pixels can try the pypdn library, accepting that it handles some versions and not others. One caution about the editor itself rather than the file: download Paint.NET from the official getpaint.net site, because search results often surface paid or ad-laden “Paint.NET” listings and bundled-installer mirrors. The .pdn file format carries no scripts or macros; it is passive image data.
References
- Paint.NET — official site (download)
- Just Solve the File Format Problem — Paint.NET image
- pypdn — Python library to read Paint.NET (PDN) files
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.