BigGustave 1.0.6
dotnet add package BigGustave --version 1.0.6
NuGet\Install-Package BigGustave -Version 1.0.6
<PackageReference Include="BigGustave" Version="1.0.6" />
paket add BigGustave --version 1.0.6
#r "nuget: BigGustave, 1.0.6"
// Install BigGustave as a Cake Addin #addin nuget:?package=BigGustave&version=1.0.6 // Install BigGustave as a Cake Tool #tool nuget:?package=BigGustave&version=1.0.6
Open, read and create PNG images in fully managed C#.
Usage
To open a PNG image from file and get some pixel values:
using (var stream = File.OpenRead(@"C:\my\file\path\file.png"))
{
Png image = Png.Open(stream);
Pixel pixel = image.GetPixel(image.Width - 1, image.Height - 1);
int pixelRedAverage = 0;
pixelRedAverage += pixel.R;
pixel = image.GetPixel(0, 0);
pixelRedAverage += pixel.R;
Console.WriteLine(pixelRedAverage / 2.0);
}
The PNG object has methods to inspect the header and get the pixel values. The header has properties for:
png.Header.Width
png.Header.Height
png.Header.BitDepth
png.Header.ColorType
png.Header.CompressionMethod
png.Header.FilterMethod
png.Header.InterlaceMethod
The PNG also has width and height as convenience properties from the header information:
png.Width == png.Header.Width
png.Height == png.Header.Height
And a property that indicates if the image uses transparency:
png.HasAlphaChannel
To get a pixel use:
Pixel pixel = png.GetPixel(0, 7);
Where the first argument is x (column) and the second is y (row). The Pixel
is used for all image types, e.g. Grayscale, Colour, with/without transparency.
Creation
To create a PNG use:
var builder = PngBuilder.Create(2, 2, false);
var red = new Pixel(255, 0, 0);
builder.SetPixel(red, 0, 0);
builder.SetPixel(255, 120, 16, 1, 1);
using (var memory = new MemoryStream())
{
builder.Save(memory);
return memory.ToArray();
}
You can also load a PNG into a builder which will copy all the pixel values into the builder for easy editing:
var png = Png.Create(@"C:\files\my.png");
var builder = PngBuilder.FromPng(png);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BigGustave:
Package | Downloads |
---|---|
AkazawaYun.Unity
This is a Unity Library by AkazawaYun ฅ(*^▽^*)ฅ 但是因为俺作为业余时间里一直想c#编程做独立游戏的蠢萌开发者还不知道怎么保护开源TvT所以还没准备完全开源_(:3/, 所以到 x.x.24.1027 版本为止, 里面是空的_(:3/ |
GitHub repositories
This package is not used by any popular GitHub repositories.