Zavolokas.GdiExtensions 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Zavolokas.GdiExtensions --version 1.0.0
NuGet\Install-Package Zavolokas.GdiExtensions -Version 1.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="Zavolokas.GdiExtensions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zavolokas.GdiExtensions --version 1.0.0
#r "nuget: Zavolokas.GdiExtensions, 1.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.
// Install Zavolokas.GdiExtensions as a Cake Addin
#addin nuget:?package=Zavolokas.GdiExtensions&version=1.0.0

// Install Zavolokas.GdiExtensions as a Cake Tool
#tool nuget:?package=Zavolokas.GdiExtensions&version=1.0.0

GDI+ Extensions

license

Contains extension methods to deal with Image classes.

Contents

  1. Scaling
  2. Opacity
  3. Channels copy

Scaling

Clones an original image to a new one with changed size.

using (var bitmap = new Bitmap(pathToImageFile))
using (var scaled = bitmap.CloneWithScaleTo(300, 80))
{
    scaled
        .SaveTo(resultPath, ImageFormat.Png)
        .ShowFile();
}
Input image Result
input1 scalingOutput1

Opacity

Clones an original image to a new one with the opacity set to the specidied.

using (var image = new Bitmap(pathToImageFile))
using (var semiTransparent = image.CloneWithOpacity(0.3f))
{
    semiTransparent
        .SaveTo(resultPath, ImageFormat.Png)
        .ShowFile();
}
Input image Result
input1 opacityOutput

Channels copy

Replaces channel values from a source RGBA image.

Note: The dest and source images should be of the same size.

using (var source = new Bitmap(pathToSrcImage))
using (var dest = new Bitmap(pathToDestImage))
{
    const int dstChannelIndex = 2;
    const int srcChannelIndex = 3;

    dest.CopyChannel(dstChannelIndex, source, srcChannelIndex)
        .SaveTo(resultPath, ImageFormat.Png)
        .ShowFile();
}
Dest Src
input1 input2
Replace Red with Alpha Replace Green with Alpha Replace Blue with Alpha
channelsOutputAR channelsOutputAG channelsOutputAB
Product Compatible and additional computed target framework versions.
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Zavolokas.GdiExtensions:

Package Downloads
Zavolokas.SeamCarving

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Zavolokas.GdiExtensions:

Repository Stars
zavolokas/Inpainting
Want to remove something(someone) from a photo as it never was there? This is .NET implementation of content-aware fill. It smartly fills in unwanted or missing areas of photographs.
zavolokas/SeamCarving
Image processing method that allows to remove an object from a photo.
Version Downloads Last updated
2.0.0.5 1,932 10/30/2019
2.0.0.4 522 10/30/2019
1.0.0 2,191 12/12/2017