ChinaLicensePlateGenerator 2.0.0

dotnet add package ChinaLicensePlateGenerator --version 2.0.0
                    
NuGet\Install-Package ChinaLicensePlateGenerator -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ChinaLicensePlateGenerator" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChinaLicensePlateGenerator" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ChinaLicensePlateGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ChinaLicensePlateGenerator --version 2.0.0
                    
#r "nuget: ChinaLicensePlateGenerator, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ChinaLicensePlateGenerator@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ChinaLicensePlateGenerator&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ChinaLicensePlateGenerator&version=2.0.0
                    
Install as a Cake Tool

ChinaLicensePlateGenerator

中国车牌图片生成器,基于 SkiaSharp 纯托管实现,跨平台零原生依赖。

安装

dotnet add package ChinaLicensePlateGenerator

快速开始

using ChinaLicensePlateGenerator;

var gen = new LicensePlateGenerator();

// 生成图片字节数组
byte[] img = gen.Generate("粤B12345", PlateType.蓝牌);

// 生成双层车牌
byte[] img2 = gen.Generate("粤B6789挂", PlateType.挂车, isDouble: true);

// 保存到文件
gen.Generate("粤B12345", PlateType.蓝牌, "/path/to/output.jpg");

支持的车牌类型

类型 枚举值 说明
蓝牌 PlateType.蓝牌 普通小型汽车
黄牌 PlateType.黄牌 大型汽车、教练车
黑牌 PlateType.黑牌 外资、使领馆、港澳黑牌
小型新能源 PlateType.小型新能源车号牌 渐变绿色小型新能源
大型新能源 PlateType.大型新能源车号牌 渐变绿色大型新能源
警车 PlateType.警车 警用车辆
挂车 PlateType.挂车 挂车

API

// 返回 JPEG 字节数组,isDouble 默认 false
byte[] Generate(string plateNumber, PlateType plateType, bool isDouble = false)

// 保存到文件,自动创建目录
void Generate(string plateNumber, PlateType plateType, string filePath, bool isDouble = false)

特性

  • 纯托管 SkiaSharp 实现,跨平台运行(Windows / Linux / macOS)
  • 模板资源嵌入程序集,零外部文件依赖
  • 线程安全,适合单例使用
  • 支持单层(440×140)和双层(480×220)车牌
  • 红字自动识别(警、使、领)

框架支持

  • .NET 8.0+
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 146 5/26/2026