XImage.Raster
Features
Tech Specs
How-to C#
Pricing

C# Imaging Library
How to draw, print text on an image using XImage.Raster C# Imaging library?


How to draw, print text on an image in C# ASP.NET Core, MVC, Windows Form, WPF, console applications?





.NET imaging SDK provides standard based and robust technique for Visual C# developers to draw text on images in your applications. These image text, graph annotation SDK API can be seamlessly implemented into C# image projects with the capabilities of drawing text on image.

RasterEdge XImage.Raster C# Imaging SDK is an advanced image solution in the market. It allows .NET developers to draw images in various .NET Framework applications, especially for C#, VB, .NET Windows Forms and ASP.NET web form applications. For beginners, we provide detailed online image drawing tutorial in each programming environment within .NET WinForms project and apply image drawing function in ASP.NET platform.


How to draw, print text on raster images using C#?

  1. Download XImage.Raster C# imaging library
  2. Install C# library to draw, print text on raster images in .NET applications
  3. Step by Step Tutorial










Quick to draw text string on an image in C#



Here we will try to create an empty image from scratch, and print text on it in a C# application.
  1. Create a new RasterImage image object with specified width, height and white background color.
  2. Use method DrawMethod.DrawText() to print text string on the image.

RasterImage image = new RasterImage(200, 200, Color.White);
String text = "XImage.Raster";
DrawMethod.DrawText(image, text, 50, 50); 
image.Save("C://output//raster-image-drawing-text-sample.png");


Run the application, you will find the text printed on an empty image.





Print text on specified page in multi-page TIFF or GIF image file in C#

You can use the following API to draw text on specified page on a multiple pages image file (such as TIFF, or GIF) in C# application. The pageIndex value is starting from 0.

public static void DrawText(RasterImage image, String text, int xOffset, int yOffset, int pageIndex)




Draw customized text on an image in C#



Using XImage.Raster C# Imaging library, you can freely customize the printing text style on the image. You can design the text font style, font size, text outline color using the C# example source code below.

  • Create a DrawingInfo object
  • Choose the font name, size, fill and outline colors
  • Call DrawText method to print the styled text string on the image

RasterImage image = new RasterImage(200, 200, Color.White);
String text = "XImage.Raster";
DrawingInfo info = new DrawingInfo();
info.FontName = "Calibri";
info.FontSize = 20;
info.FillColor = Color.Blue;
info.OutLineColor = Color.Red;
DrawMethod.DrawText(image, text, 50, 50, info);
image.Save("C://output//raster-image-drawing-text-customized.png");






Draw styled text on multi-page TIFF or GIF image file in C#

Here is the API for printing styling text string on multi-page TIFF or GIF image file in C#. The pageIndex value is starting from 0.

public static void DrawText(RasterImage image, String text, int xOffset, int yOffset, DrawingInfo info, int pageIndex)