Regex to parse image data URI

后端 未结 5 2291
野性不改
野性不改 2021-02-07 04:29

If I have :



        
5条回答
  •  半阙折子戏
    2021-02-07 04:58

    Actually, you don't need a regex for that. According to Wikipedia, the data URI format is

    data:[][;charset=][;base64],
    

    so just do the following:

    byte[] imagedata = Convert.FromBase64String(imageSrc.Substring(imageSrc.IndexOf(",") + 1));
    

提交回复
热议问题