WMF to Base64String
-
Yes: all files are just a stream of byte values - it's the interpretation that software puts on the internal format of those bytes that makes it a "WMF" or "JPG" file. The extension just indicates what format the software should look for.
string base64 = Convert.ToBase64String(file.ReadAllBytes(@"D:\Temp\myPicture.wmf"));
However, that doesn't mean that whatever you pass the base64 string to can do anything useful with it. For example, not all browsers support WMF file data in any format, and changing it to Base64 will not fix that. WMF is pretty much a "Windows only" image format: you would probably be better off using a more generic format such as JPG, GIF, or PNG.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Yes: all files are just a stream of byte values - it's the interpretation that software puts on the internal format of those bytes that makes it a "WMF" or "JPG" file. The extension just indicates what format the software should look for.
string base64 = Convert.ToBase64String(file.ReadAllBytes(@"D:\Temp\myPicture.wmf"));
However, that doesn't mean that whatever you pass the base64 string to can do anything useful with it. For example, not all browsers support WMF file data in any format, and changing it to Base64 will not fix that. WMF is pretty much a "Windows only" image format: you would probably be better off using a more generic format such as JPG, GIF, or PNG.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
wow! that's just in one line!!! Thanks very much! How do I load it back to a form? :confused:
Um... Convert.FromBase64String[^] :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Um... Convert.FromBase64String[^] :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...