
Les marques d’eau jouent un rôle vital dans l’affirmation de la propriété des images et la prévention de l’utilisation non autorisée ou de la contrefaçon. La mise en œuvre d’une fonctionnalité de marquage d’eau automatisée dans vos applications web ou de bureau peut considérablement améliorer la sécurité de votre image. Dans cet article, nous vous guiderons par le processus d’ajouter des marques d’eau aux images programmatiquement en utilisant C#**. En outre, vous apprendrez comment ajouter une marque d’eau aux fichiers PDF en utilisant C# pour sécuriser davantage vos documents.
Table des contenus
- API C# pour ajouter un watermark aux images
- Ajouter Watermark à une image en C#
- Ajouter Diagonal Watermark à des images en C#
- Obtenez une licence API gratuite
C# API pour ajouter Watermark aux images
To add watermarks to images, we will utilize the Aspose.Imaging pour .NET. This powerful image processing API supports various formats, including PNG, JPEG, and BMP, making image manipulation straightforward. You can either Téléchargez les API Binaires or install it via Nouveau using the following command:
PM> Install-Package Aspose.Imaging
Ajouter Watermark à une image en C#
Suivez ces étapes pour ajouter un watermark à une image en utilisant C# :
- Load the image using the Immagine class.
- Create an instance of the Graphiques class, initializing it with the Immagine object.
- Define the font family, size, and style using the Fonts class.
- Create a Développement 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 Étiquette : Save (String) method.
Voici un échantillon de code montrant comment ajouter un watermark à une image en C#:

C# Ajouter Diagonal Watermark à des images
Parfois, les marques d’eau sont appliquées diagonnellement à travers les images pour un effet plus distinctif. L’Aspose.Imaging pour .NET API vous permet de tourner le texte de la marque d’eau pour ce faire. Voici comment ajouter une marque d’eau diagonale:
- Load the image using the Immagine class.
- Create a Graphiques instance initialized with the Immagine object.
- Define the font family, size, and style with the Fonts class.
- Create a Développement 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 Étiquette : Transformation property.
- Add the watermark using the Graphics.DrawString(String, Font, SolidBrush, 0, StringFormat) method.
- Save the image using the Étiquette : Save (String) method.
Voici un échantillon de code qui illustre comment ajouter un watermark diagonal aux images en utilisant C#:

Insérer un watermark sur les images avec une licence gratuite
You can obtenir une licence temporaire gratuite to insert watermarks on images without any evaluation limitations.
Conclusion
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 La documentation. If you have any questions or need assistance, feel free to reach out via our Forum.
Vedi anche
More in this category
- C# Animation Maker Plugin: Créez des animations étonnantes avec Aspose.Imaging
- Aspose.Imaging Image Effect Plugin : améliorer vos images avec des filtres avancés
- Unisci immagini in C# con il plugin Aspose.Imaging Image Merger da $99
- Elaborazione delle immagini aziendali a prezzi accessibili con Aspose.Imaging
- Rotazione Immagini Economica in C# | Plugin Aspose.Imaging $99