
Wassermarken spielen eine entscheidende Rolle bei der Behauptung des Eigentums von Bildern und verhindern unbefugte Verwendung oder Fälschung. Durch die Implementierung einer automatisierten Wassermarken-Funktion in Ihren Web- oder Desktop-Anwendungen kann die Bildsicherheit erheblich verbessern. In diesem Artikel werden wir Sie durch den Prozess der Adding watermarks to images programmatically using C#. Darüber hinaus werden Sie lernen wie ein Wassermarken zu PDF-Dateien mit C# hinzufügen, um Ihre Dokumente weiter zu sichern!
Tabelle der Inhalte
- C# API, um Wassermarke an Bilder hinzuzufügen
- Fügen Sie Watermark zu einem Bild in C# hinzu#
- Add Diagonal Watermark to Images in C#
- Erhalten Sie eine kostenlose API-Lizenz
C# API zum Add Watermark to Images
To add watermarks to images, we will utilize the Aspose.Imaging für .NET. This powerful image processing API supports various formats, including PNG, JPEG, and BMP, making image manipulation straightforward. You can either Download der API-Binaren or install it via Neugier using the following command:
PM> Install-Package Aspose.Imaging
Add Watermark to an Image in C#
Folgen Sie diesen Schritten, um ein Wasserzeichen zu einem Bild mit C# hinzuzufügen#:
- Load the image using the Bild class.
- Create an instance of the Grafiken class, initializing it with the Bild object.
- Define the font family, size, and style using the Fontaine class.
- Create a Die SolidBrush instance to set properties like color.
- Instantiate the StringFormat class to manage text alignment.
- Add the watermark to the image using the Graphics.DrawString(String, Font, SolidBrush, 0, StringFormat) method.
- Save the image using the Bild zu speichern (String) method.
Hier ist ein Code-Sample, das zeigt, wie man ein Wasserzeichen zu einem Bild in C# hinzufügt#:

C# Add Diagonal Watermark to Images
Manchmal werden Wassermarken diagonalerweise über Bilder angewendet, um einen charakteristischen Effekt zu erzielen. Die Aspose.Imaging für .NET API ermöglicht es Ihnen, den Wassermarkentext zu drehen, um dies zu erreichen:
- Load the image using the Bild class.
- Create a Grafiken instance initialized with the Bild object.
- Define the font family, size, and style with the Fontaine class.
- Create a Die SolidBrush instance to set properties like color.
- Instantiate a StringFormat object for text alignment.
- Create a Matrix instance to set the transformation angle.
- Assign the Matrix object to the Grafik - Transformation property.
- Add the watermark using the Graphics.DrawString(String, Font, SolidBrush, 0, StringFormat) method.
- Save the image using the Bild zu speichern (String) method.
Hier ist ein Code-Sample, das illustriert, wie man eine diagonale Wassermarke an Bilder mit C# hinzufügt#:

Einfügen Sie Wassermarken auf Bilder mit einer kostenlosen Lizenz
You can Erhalten Sie eine kostenlose vorübergehende Lizenz to insert watermarks on images without any evaluation limitations.
Schlussfolgerungen
In this article, you learned how to add a watermark to images in C#. You also discovered how to rotate watermark text and how to add a watermark in PDF using C#. For further information about the C# image processing API, please refer to the Dokumentation. If you have any questions or need assistance, feel free to reach out via our Forum.
Sehen Sie auch
More in this category
- C# Animation Maker Plugin: Erstellen Sie erstaunliche Animationen mit Aspose.Imaging
- Aspose.Imaging Image Effect Plugin: Verbessern Sie Ihre Bilder mit fortschrittlichen Filtern
- Bilder in C# mit dem $99 Aspose.Imaging Image Merger Plugin zusammenführen
- Erschwingliche Unternehmensbildverarbeitung mit Aspose.Imaging
- Erschwingliche Bilddrehung in C# | Aspose.Imaging $99 Plugin