C#Base64를 이미지로 변환하여 Image 배열에 저장

811 단어 C#
private byte[] pictureToByte;   //      ,      
/// 
///           Byte
/// 
public byte[] PictureToByte
{
    get
    {
        if(!string.IsNullOrEmpty(PictureData)){

        pictureToByte = Convert.FromBase64String(PictureData); //PictureData       string   Base64

        return pictureToByte;
    }
    return null;

}
Images = new Image[Base64Items.Count]; //Image         

//       Base64          Image  
for(int i = 0 ; i < Base64Items.Count ; i++ )
{
    MemoryStream ms = new MemoryStream(Base64Items[i].PictureToByte);
    Image image = Image.FromStream(ms);
    ms.Flush();
    Images[i] = image;
    //_menuImages[i].Save(@"e:/test"+ i +".png",System.Drawing.Imaging.ImageFormat.Png);//                  
}

Image            

좋은 웹페이지 즐겨찾기