Hello,
i have developed one flash tool to develop custom desing.and i am saving it using server code
my code is below
1 protected void Page_Load(object sender, EventArgs e)
2 {
3 if (!IsPostBack)
4 {
5 string width1 = Request.Form.Get("width");
6 string height1 = Request.Form.Get("height");
7 string filename = Request.QueryString["dname"].ToString();
8 int height = Convert.ToInt32(height1);
9
10 Bitmap bmp = new Bitmap(width, height);
11 bmp = GrayScale(bmp);
12
13 bmp.Save(Server.MapPath(@"~/Uploads/" + filename), ImageFormat.Gif);
14 }
15 }
16 public Bitmap GrayScale(Bitmap Bmp)
17 {
18 int rgb=0;
19 Color c=Color.White;
20 Bmp.MakeTransparent();
21 for (int rows = 0; rows < Bmp.Height; rows++)
22 {
23
24 string name=Request.Form.Get("px" + rows.ToString());
25 string[] c_row = name.Split(new char[] { ',' } , StringSplitOptions.RemoveEmptyEntries);
26 for (int cols = 0; cols < Bmp.Width; cols++)
27 {
28
29 string value="";
30 try
31 {
32 value = c_row[cols];
33 }
34 catch (Exception) { }
35 if (value != "")
36 {
37 string hex = value;
38 while(hex.Length< 6)
39 {
40 hex = "0" + hex;
41 }
42 string r = gethax(hex.Substring(0, 2));
43 string g = gethax(hex.Substring(2, 2));
44 string b = gethax(hex.Substring(4, 2));
45 c = Bmp.GetPixel(cols,rows);
46
47 Bmp.SetPixel(cols, rows, Color.FromArgb(Convert.ToInt32(r), Convert.ToInt32(g), Convert.ToInt32(b)));
48
49 }
50
51
52 }
53 }
54 return Bmp;
55 }
56 protected string gethax(string text)
57 {
58 string hex = "";
59 byte[] byt = new byte[7869];
60 byt=System.Text.ASCIIEncoding.ASCII.GetBytes(text);
61 foreach (int i in byt)
62 {
63 hex = Convert.ToString(i, 16);
64 }
65 return hex;
66 }
here i am generating image with parameters that i am getting from flash file .Image is generated successfully but i am not getting proper background.I am getting gray background.
I want that image with transparent background. i have used graphics.fillrectangal with white color.But it makes whole image white, i am not able to see image formed of flash parameters.
Help me if anyone knows.
Any help will be appreciated.
Thank You.