namespace NVGIF - NVGIF C# Implementation

Source: csharp/NVGIF.cs

The C# implementation of NVGIF requires System.Drawing.Common. It is Windows‑specific, supports v1–v4, and can only decode NVGIF files. Example usage: csharp/NVGIFTest.cs.

class NVGIF

An NVGIF decoder. Supports v1–4.

enum CompressionType

An enum of compression types.

None

No compression.

RLE

RLE compression.

Zlib

Zlib compression.

RLE_Zlib

RLE and Zlib compression. See spec for details.

static Bitmap Decode (Byte[] nvgData)

Decode an NVGIF buffer (v1..v4) and return a Bitmap.

Example

Decode an NVGIF and save it as PNG:

using System;
using System.Drawing;        // for Bitmap
using System.Drawing.Imaging; // for ImageFormat
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        byte[] bytes = File.ReadAllBytes("../images/drawing.nvg4");
        Bitmap bmp = NVGIF.NVGIF.Decode(bytes);
        bmp.Save("decoded.png", ImageFormat.Png);
        Console.WriteLine("NVGIF decoded!");
    }
}