Create a page say Handler.aspx with following code in page_load event
protected void Page_Load(object sender, EventArgs e)
{
string colorCode = Request.QueryString["color_code"];
using (System.Drawing.Bitmap bitMap = new System.Drawing.Bitmap(150, 80))
{
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitMap))
{
System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.ColorTranslator.FromHtml("#" + colorCode));
graphics.FillRectangle(brush, 0, 0, bitMap.Width, bitMap.Height);
}
bitMap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.End();
}
}
Then simply call it in following way on the page where you want to display colors
<asp:Image ID="Image2" runat="server" ImageUrl = "~/Handler.aspx?color_code=ccc" />
<asp:Image ID="Image3" runat="server" ImageUrl = "~/Handler.aspx?color_code=fff001" />
<asp:Image ID="Image1" runat="server" ImageUrl = "~/Handler.aspx?color_code=b09dc3" />