Created
May 25, 2026 11:42
-
-
Save aspose-com-gists/369d04b4bf5af7d760d4e3987fe3e86f to your computer and use it in GitHub Desktop.
Write Text on JPG Image in .NET–STEP-by-STEP Guide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Write Text on JPG Image in .NET-STEP-by-STEP Guide | |
| // Read the full guide here: https://blog.aspose.com/drawing/write-text-on-jpg-image-in-dotnetstep-by-step-guide/ | |
| using System; | |
| using Aspose.Drawing; | |
| using Aspose.Drawing.Imaging; | |
| using Aspose.Drawing.Drawing2D; | |
| using Aspose.Drawing.Fonts; | |
| using Aspose.Drawing.Brushes; | |
| using Aspose.Drawing.Colors; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| // Load the JPG image | |
| using (Image image = Image.Load("input.jpg")) | |
| { | |
| // Create a Graphics object for drawing | |
| using (Graphics graphics = new Graphics(image)) | |
| { | |
| // Define the font (Arial, 36pt, bold) | |
| Font font = new Font("Arial", 36, FontStyle.Bold); | |
| // Define the brush (red color) | |
| SolidBrush brush = new SolidBrush(Color.Red); | |
| // Position where the text will be drawn | |
| PointF location = new PointF(50, 50); | |
| // Draw the text onto the image | |
| graphics.DrawString("Hello, Aspose!", font, brush, location); | |
| } | |
| // Save the edited image as a new JPG file | |
| image.Save("output.jpg", ImageFormat.Jpeg); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment