static public string makeIcon(string imagedata) { byte[] imageBytes = decode(imagedata); Random random = new Random(); string randomName = random.Next().ToString(); Gif gif = new Gif(imageBytes, imageBytes.Length, 32, 32, 4, randomName + ".gif"); gif.write(); //string x = Path.GetTempPath() + randomName + ".gif"; Bitmap image = new Bitmap(Path.GetTempPath() + randomName + ".gif"); MemoryStream mStream = new MemoryStream(); image.Save(mStream, ImageFormat.Gif); byte[] bytes = mStream.GetBuffer(); mStream.Close(); mStream.Dispose(); image.Dispose(); return(Convert.ToBase64String(bytes)); //return x; }