简体   繁体   中英

Uuencoded image to byte array

How do I convert uuencoded image to byte array?

My image is encoded like this:

begin 644 image.jpg
M_]C_X``02D9)1@`!``$`8`!@``#__@`?3$5!1"!496-H;F]L;V=I97,@26YC
********************** MANY LINES ***************************
MH`R]:TM=9TJ^TIK_`%32UO8#`;_1;V33=5M,E6\VQOH@9+:<8P)$!(!8=Z`,
M#P;X#T+P-!J"Z2=1O+_5[E+S6=<UO4)]6UW6+B-#%!)J&HW)\R46\1,<$2+'
/#&&=EC\V6:20`[.@#__9
`   
end

I would like to get byte array without need to save image on hdd first. After decoding I will save it directly into DB.

You have to remove the first and last line, many solutions here, RegEx are funny :o)

Then Convert.FromBase64String method should do the trick.

Edit

I was wrong since uuencode is not Base64 .

You will have to find a third-party implementation. Here or here.

Or maybe use a native library like active template library .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM