The picture of course is the existence of that JS file inside, so I opened the flashblocker.js, and then browse, find the following sentence:
var flash = ' Data:image/png;base64,ivborw0kggoaaaansuheugaaaiaaaacacayaa ... '
(small white) <span style= "Font-size:small" > This is the first time I recognize the use of Base64, remember the previous save the page, The total habit is saved in the. mht format, because this will save the pictures in the Web page, but always wonder why only one </SPAN>
View Sourceprint?<span style= "Font-size:small" > MHT file, open to have a picture, now know to save as a mht format all the pictures in the page into the Base64 string exists inside. </SPAN>
View Sourceprint?<span style= "Font-size:small" > </span><span style= "Font-size:small" > Implementation: </ Span>
View Sourceprint?<span style= "Font-size:small" > </SPAN >
In fact very simple, picture file to base64string conversion, only need convert class inside a tobase64string method can
Copy Code code as follows:
Image fromimage = Image.FromFile (Txtimg.text);
MemoryStream stream = new MemoryStream ();
Fromimage.save (Stream, imgformat[extension]);
Txtstring.text = Convert.tobase64string (stream. GetBuffer ());
Add here, seemingly icon file is not convertible (the results of their own test), need to change the words will be modified, curve save the Nation ~
The Convert.frombase64string () method is needed to extract pictures from base64string.
Copy Code code as follows:
MemoryStream stream = new MemoryStream (convert.frombase64string (Txtstring.text));
Bitmap img = new Bitmap (stream);
Img. Save (Txtimg.text);
MessageBox.Show ("completed!");
It seems that some comrades in the conversion back to a problem, the feeling should be defined stream when the problem, new when directly to the conversion of the byte[] to it, there should be no "beyond the scope of the expected" error. The conversion problem should not be related to the original artwork in Java or other languages. Because the base64 code should be the same.
Author: Mr. Fix
Source: http://1971ruru.cnblogs.com