Nsp.Framework.Watermark
1.0.0
dotnet add package Nsp.Framework.Watermark --version 1.0.0
NuGet\Install-Package Nsp.Framework.Watermark -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="Nsp.Framework.Watermark" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nsp.Framework.Watermark" Version="1.0.0" />
<PackageReference Include="Nsp.Framework.Watermark" />
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 Nsp.Framework.Watermark --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Nsp.Framework.Watermark, 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.
#:package Nsp.Framework.Watermark@1.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=Nsp.Framework.Watermark&version=1.0.0
#tool nuget:?package=Nsp.Framework.Watermark&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Use package
File read and save use
var resource = "Resources";
{
Console.WriteLine("watermark path");
var subDir = "watermark_path/";
Directory.CreateDirectory(subDir);
var watermark = new Watermark("nextstar.space")
{
TextSize = 24
};
var inputPath = Path.Combine(resource, "chrome_zEjXw3YDnT.gif");
var sw = new Stopwatch();
sw.Start();
// single gif
watermark.Position = WatermarkPosition.BottomLeft;
var outputSinglePath = Path.Combine(subDir, "chrome_zEjXw3YDnT_single.gif");
watermark.Execute(inputPath, outputSinglePath);
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
// full gif
watermark.Position = WatermarkPosition.Full;
var outputFullPath = Path.Combine(subDir, "chrome_zEjXw3YDnT_full.gif");
watermark.Execute(inputPath, outputFullPath);
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
var inputPath2 = Path.Combine(resource, "image2.png");
// single png
watermark.Position = WatermarkPosition.BottomLeft;
var outputSinglePath2 = Path.Combine(subDir, "output_single.png");
watermark.Execute(inputPath2, outputSinglePath2);
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
// full png
watermark.Position = WatermarkPosition.Full;
var outputFullPath2 = Path.Combine(subDir, "output_full.png");
watermark.Execute(inputPath2, outputFullPath2);
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
}
File stream use
var resource = "Resources";
{
Console.WriteLine("watermark_stream use stream");
var subDir = "watermark_stream/";
Directory.CreateDirectory(subDir);
var watermark = new Watermark();
var inputPath = Path.Combine(resource, "chrome_zEjXw3YDnT.gif");
var sw = new Stopwatch();
sw.Start();
// single gif
using (var inputStream = File.OpenRead(inputPath))
{
watermark.Position = WatermarkPosition.BottomLeft;
var outputSinglePath = Path.Combine(subDir, "chrome_zEjXw3YDnT_single.gif");
inputStream.Seek(0, SeekOrigin.Begin);
var outputSingleStream = watermark.Execute(inputStream, WatermarkImageFormat.Gif);
using (var outputFile = File.Create(outputSinglePath))
{
outputSingleStream.CopyTo(outputFile);
}
}
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
// full gif
using (var inputStream = File.OpenRead(inputPath))
{
watermark.Position = WatermarkPosition.Full;
var outputFullPath = Path.Combine(subDir, "chrome_zEjXw3YDnT_full.gif");
inputStream.Seek(0, SeekOrigin.Begin);
var outputFullStream = watermark.Execute(inputStream, WatermarkImageFormat.Gif);
using (var outputFile = File.Create(outputFullPath))
{
outputFullStream.CopyTo(outputFile);
}
}
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
var inputPath2 = Path.Combine(resource, "image2.png");
// single png
using (var inputStream = File.OpenRead(inputPath2))
{
watermark.Position = WatermarkPosition.BottomLeft;
var outputSinglePath2 = Path.Combine(subDir, "output_single.png");
inputStream.Seek(0, SeekOrigin.Begin);
var outputSingleStream2 = watermark.Execute(inputStream, WatermarkImageFormat.Png);
using (var outputFile = File.Create(outputSinglePath2))
{
outputSingleStream2.CopyTo(outputFile);
}
}
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
// full png
using (var inputStream = File.OpenRead(inputPath2))
{
watermark.Position = WatermarkPosition.Full;
var outputFullPath2 = Path.Combine(subDir, "output_full.png");
inputStream.Seek(0, SeekOrigin.Begin);
var outputFullStream2 = watermark.Execute(inputStream, WatermarkImageFormat.Png);
using (var outputFile = File.Create(outputFullPath2))
{
outputFullStream2.CopyTo(outputFile);
}
}
sw.Stop();
Console.WriteLine(sw.Elapsed.ToString("c"));
sw.Restart();
}
Result
GIF Image


Normal Image


| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Magick.NET-Q16-AnyCPU (>= 13.5.0)
- SkiaSharp (>= 2.88.7)
- System.Drawing.Common (>= 8.0.1)
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 | 251 | 1/17/2024 |