C#

This example creates lettering image from web service and merges it with image of T-Shirt, Also creates link to download fullfillment file for image, and creates embedded stitchplayer component

Download Zip File with complete source code

Go Here to see this example running. 

Source Code for function which merges api image with base product image centered at pixel (px,py):

public Byte[] DrawImageToProduct(HttpContext context,int px,int py)
{
    //Get text from query string for handler
    string text = "Hello";
    if (context.Request.QueryString["text"] != null)
    {
        text = (string)context.Request.QueryString["text"];
    }
    text = HttpUtility.UrlEncode(text);
    string url = "http://api.livedesigner.com/"+username+"/GetImage/Lettering?alphabet=DIANE%20SCRIPT&text="+text+"&color=ccaa00&dpi=32";
 
    // compute security hash for url
    string hash = CalculateMD5Hash(url+licensekey);
    WebClient Client = new WebClient();
    // set authorization header
    Client.Headers.Add("Authorization", "LDWS "+username+":"+hash);
 
    // download lettering graphic
    Byte[] lettergraphic = Client.DownloadData(url);
 
    // create product Bitmap from jpg stored on disk
    string imagepath = context.Server.MapPath("Images\\Blue%20Polo%20Cropped_Enlarged.jpg");
    System.Drawing.Bitmap ProductImage = new System.Drawing.Bitmap(imagepath);
    System.Drawing.Bitmap LetterImage = null;
 
    // create letter bitmap from url downloaded from web service
    MemoryStream ms2 = new MemoryStream(lettergraphic);
    LetterImage = new System.Drawing.Bitmap(ms2);
 
    // draw letter bitmap to product bitmap
    System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(ProductImage);
    g.PageUnit = System.Drawing.GraphicsUnit.Pixel;
    g.DrawImage(LetterImage, new System.Drawing.Rectangle(px-LetterImage.Width/2, py-LetterImage.Height/2, LetterImage.Width, LetterImage.Height), new System.Drawing.Rectangle(0, 0, LetterImage.Width, LetterImage.Height), System.Drawing.GraphicsUnit.Pixel);
    g.Dispose();
 
    // encode merged bitmap to png
    MemoryStream ms3 = new MemoryStream();
    ProductImage.Save(ms3, System.Drawing.Imaging.ImageFormat.Jpeg);
    byte[] savefile = ms3.GetBuffer();
 
    // return bytes
    return savefile;
}