OledSharp.Png
1.0.0
dotnet add package OledSharp.Png --version 1.0.0
NuGet\Install-Package OledSharp.Png -Version 1.0.0
<PackageReference Include="OledSharp.Png" Version="1.0.0" />
<PackageVersion Include="OledSharp.Png" Version="1.0.0" />
<PackageReference Include="OledSharp.Png" />
paket add OledSharp.Png --version 1.0.0
#r "nuget: OledSharp.Png, 1.0.0"
#:package OledSharp.Png@1.0.0
#addin nuget:?package=OledSharp.Png&version=1.0.0
#tool nuget:?package=OledSharp.Png&version=1.0.0
OledSharp.Png
A .NET 8.0 implementation of IOledDisplay
that outputs display content to PNG image files. This library is perfect for testing, debugging, and visualizing what would be displayed on an OLED screen without needing physical hardware.
This is a software implementation for testing and visualization. For the main library documentation and general usage, see OledSharp.
Overview
This library provides the PngOutputDisplay
class which implements the IOledDisplay
interface from the base OledSharp library. Instead of controlling physical hardware, it renders the display buffer to a PNG image file, making it ideal for development, testing, and documentation purposes.
Installation
To install the OledSharp.Png library via NuGet, run the following command in your project directory:
dotnet add package OledSharp.Png
Features
- PNG Output - Renders display buffer to PNG image files
- Configurable Resolution - Default 128x64 pixels, customizable
- Individual Pixel Control - Set/get individual pixels in the display buffer
- Grayscale Output - White pixels for "on", black pixels for "off"
- File-based Output - Saves to specified file path
Dependencies
- OledSharp - Base library for display abstraction (see OledSharp)
- BigGustave - PNG creation and manipulation library
Usage Example
using OledSharp.Png;
// Create PNG output display (128x64 pixels, saves to "output.png")
using (IOledDisplay display = new PngOutputDisplay("output.png", width: 128, height: 64))
{
display.Initialize();
// Create text renderer
TextRenderer renderer = new TextRenderer(display);
// Draw with word wrapping
renderer.DrawWrappedString(
x: 2, // 2 px in from the left edge
y: 2, // 2 px in from the left edge
text: "This is a long text that will wrap",
maxWidth: display.Width - 4); // 2 px from the right edge too
// Draw individual pixels
display.SetBufferPixel(10, 10, true);
display.SetBufferPixel(11, 11, true);
// Save to PNG file
display.PushBuffer();
}
Constructor Options
With File Path Only (Default 128x64)
PngOutputDisplay display = new PngOutputDisplay("output.png");
With Custom Dimensions
PngOutputDisplay display = new PngOutputDisplay("output.png", width: 256, height: 128);
Use Cases
- Development and Testing - Visualize display output during development
- Documentation - Generate example images for documentation
- Unit Testing - Verify text rendering and graphics without hardware
- Prototyping - Test layouts and designs before implementing on hardware
Output Format
- File Format - PNG image
- Color Mode - Grayscale (white = pixel on, black = pixel off)
- Resolution - Configurable, default 128x64 pixels
- File Overwrite - Each
PushBuffer()
call overwrites the existing file
License
MIT License - see project file for details.
Repository
Product | Versions 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. |
-
net8.0
- BigGustave (>= 1.0.6)
- OledSharp (>= 1.0.0)
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 |
---|---|---|
1.0.0 | 130 | 9/7/2025 |