Link to home
Start Free TrialLog in
Avatar of Jen_M66
Jen_M66Flag for Australia

asked on

How do I create an new image using an exisiting background and adding text programatically?

Hi all, Here's what I want to do:
I have 20 odd different images which represent sign backings. I want to be able to get clients to pick a background, enter the text they want in a text box and then create a specific image which adds the text to the backing. Basically I want them to be able to see what their sign will look like. Ideally I would like to be able to use probably 8 different fonts (I understand these are differing widths) and be able to change the font color to either black or silver.  I've never worked with images in C# /.Net before so I'm looking for some kind of guideline as to where to begin. ie: What classes / how to add to an existing image, how to save that image as another etc.  
Avatar of trunghieubkit
trunghieubkit
Flag of Viet Nam image

The snippet below may help you,

if you want to draw on it before saving as another file you can create Graphics as following

           Graphics g = this.CreateGraphics();

           g.DrawImage(...);            g.DrawLine(...);            g.DrawRectangle(...);




private void Form1_Load(object sender, EventArgs e)
{
    string lstrFromFile = @"D:\From.gif";
    string lstrToFile = @"D:\To.jpeg";
 
    this.BackgroundImage = Image.FromFile(lstrFromFile);
    this.BackgroundImage.Save(lstrToFile);
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jen_M66

ASKER

Great thank you - that was much easier than I thought it would be.