In this getting started video, we’ll use GcImaging on Windows to create a company logo image with rounded rectangle.
First, visit this link to license GcImaging in your application: http://help.grapecity.com/gcdocs/gcimaging/onlinehelp/webframe.html#licenseinfo.html
This guide explains how to create a program that uses Documents for Imaging (GcImaging) to generate and save to disk a company logo image. GcImaging API is built for .NET Standard 2.0, and can be used with any target that supports it. In this short tutorial, we show how to build a .NET Core console application and use GcImaging in Visual Studio for Windows.
Let’s create a new logo image for a company with GcImaging in .NET Core application. This example will draw a rounded rectangle and draw the company name text over it to generate a logo image.
using System.IO;
using System.Drawing;
using GrapeCity.Documents.Drawing;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Imaging;
var blue = Color.FromArgb(46, 72, 132);
int pixelWidth = 350;
int pixelHeight = 100;
bool opaque = true;
float dpiX = 96;
float dpiY = 96;
float rx = 36, ry = 24;
float border = 4;
var bmp = new GcBitmap(pixelWidth, pixelHeight, opaque, dpiX, dpiY);
var g = bmp.CreateGraphics(Color.Transparent); // PNG will preserve transparency
var rEasy = new RectangleF(0, 0, pixelWidth, pixelHeight);
g.FillRoundRect(rEasy, rx, ry, Color.MediumPurple);
var tf = new TextFormat()
{
Font = Font.FromFile(Path.Combine("Resources", "Fonts", "times.ttf")),
FontSize = 24,
FontBold = true,
ForeColor = Color.White
};
Note: To draw text with a Font from file, include a TTF font in the Resources folder in the project: Resources.zip
g.DrawString("ACME INC.", tf, rEasy, TextAlignment.Center, ParagraphAlignment.Center, false);
bmp.SaveAsPng("Logo.png");
Click the "start debugging" button in Visual Studio.
That's all it takes to generate an Image using GcImaging. The ‘Logo.png’ is created in your project folder.
In order to understand in detail, how to create/modify/save an Image with advanced features and effects, refer to the GcImaging sample demo.
To learn about GcImaging product architecure and features in detail, visit the GcImaging documentation.