HPPH.WPF 2.0.0

dotnet add package HPPH.WPF --version 2.0.0
                    
NuGet\Install-Package HPPH.WPF -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="HPPH.WPF" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HPPH.WPF" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="HPPH.WPF" />
                    
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 HPPH.WPF --version 2.0.0
                    
#r "nuget: HPPH.WPF, 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 HPPH.WPF@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=HPPH.WPF&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=HPPH.WPF&version=2.0.0
                    
Install as a Cake Tool

HPPH.WPF

WPF extensions for HPPH.

Only uses what WPF already contains, so no further dependencies are needed in WPF applications.
All methods copy the pixels, the resulting images don't depend on the source.

Loading

using HPPH.WPF;

IImage image = ImageHelper.LoadImage("image.png");
Image<ColorRGB> image2 = ImageHelper.LoadImage<ColorRGB>(stream);

Without a color format the image is ColorBGR or ColorRGB if WPF decodes the file to 24 bit and ColorBGRA for everything else.
Embedded color profiles are ignored.

Converting

// WPF -> HPPH
IImage image = bitmapSource.ToImage();
Image<ColorRGB> image2 = bitmapSource.ToImage<ColorRGB>();

// HPPH -> WPF
BitmapSource bitmap = image.ToBitmapSource();             // frozen, usable on every thread
BitmapSource regionBitmap = image[10, 10, 100, 50].ToBitmapSource();
WriteableBitmap writeable = image.ToWriteableBitmap();

byte[] png = image.ToPng();

ToBitmapSource and ToWriteableBitmap create Rgb24 for ColorRGB, Bgr24 for ColorBGR and Bgra32 for 4-byte color formats.
Other pixel formats, premultiplied ones included, are converted to Bgra32 by WPF before they are read.

Updating a WriteableBitmap

CopyTo writes into an existing WriteableBitmap without allocating, for example to show a frequently changing image.

image.CopyTo(writeable);

The bitmap needs the size of the image and one of the pixel formats Bgra32, Bgr32, Bgr24 or Rgb24.
Like every access to a WriteableBitmap it has to happen on the thread the bitmap belongs to.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible.  net11.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.0

  • net11.0-windows7.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
2.0.0 0 11/14/2026