winscripter / ImgFX

Image Processing and Context library for .NET 6+ !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

imgfx

ImgFX lets you edit and get more info about images.

Compatibility

ImgFX will only run on .NET 5 or newer runtimes. .NET Core, .NET Standard may not be supported. .NET Framework is not supported.

PNG Information

Use ImgFX.Png.PngContext to achieve information about a Portable Network Graphics (PNG) image format, like:

using ImgFX.Png;

var ctx = new PngContext(File.ReadAllBytes("sillycat.png"));
Console.WriteLine($"{ctx.Width}x{ctx.Height}"); // 1920x1080

// you can use other properties, like .IHDR, .Chunks, etc.

Font Information

Fonts aren't that easy to use in ImgFX, because you need to write your own one in black & white. ImgFX does support TTFs, but it doesn't support converting them to FontContext. But you can create one yourself:

using ImgFX.Fonts;

var table = new FontTextTable(
    5, // height of the image in pixels
    3, // width of the image in pixels
    100, // scaling for this character in font (100%)
    65, // unicode representation for A
    new bool[]
    {
        true, true, true,   //    ######
        true, false, true,  //    ##--##
        true, true, true,   //    ######
        true, false, true,  //    ##--##
        true, false, true   //    ##--##   
    }
);

var cxt = new FontContext(
    "ImgFX Test Font",
    new FontTextTable[] { table }
);

RGB & RGBA

Specify RGB and RGBA colors easily.

using ImgFX.Argb;
using ImgFX.Rgb;

var rgba = new Argb(0xFF, 0x00, 0x00, 10); // opacity is 1.0
var rgb = new Rgb(0xFF, 0x00, 0x00);

Console.WriteLine(rgb.ToCssRgb());
Console.WriteLine(rgb.ToCssRgba());

This is not it!

There's more what ImgFX is capable of. The basics is enough for now!

About

Image Processing and Context library for .NET 6+ !

License:MIT License


Languages

Language:C# 79.6%Language:CSS 12.8%Language:JavaScript 5.6%Language:HTML 2.0%