ASP. NET html to convert images,

Source: Internet
Author: User

ASP. NET html to convert images,

Using System. IO; using System. drawing; using System. threading; using System. windows. forms; public class evaluate {Bitmap m_Bitmap; string m_Url; int m_BrowserWidth, m_BrowserHeight, cosine, m_ThumbnailHeight; public evaluate (string Url, int BrowserWidth, int BrowserHeight, int ThumbnailWidth, int ThumbnailHeight) {m_Url = Url; m_BrowserHeight = BrowserHeight; m_BrowserWidth = BrowserWidth; width = ThumbnailWidth; width = ThumbnailHeight;} public static Bitmap values (string Url, int BrowserWidth, int BrowserHeight, int ThumbnailWidth, int ThumbnailHeight) {signature Signature = new signature (Url, browserWidth, BrowserHeight, ThumbnailWidth, ThumbnailHeight); return thumbnailGenerator. generateWebSiteThumbnailI Mage ();} public Bitmap GenerateWebSiteThumbnailImage () {Thread m_thread = new Thread (new ThreadStart (_ GenerateWebSiteThumbnailImage); m_thread.SetApartmentState (ApartmentState. STA); m_thread.Start (); m_thread.Join (); return m_Bitmap;} private void _ forward () {WebBrowser m_WebBrowser = new WebBrowser (); m_WebBrowser.ScrollBarsEnabled = false; m_WebBrowser.Navigate (m_Url ); M_WebBrowser.DocumentCompleted + = new WebBrowserDocumentCompletedEventHandler (WebBrowser_DocumentCompleted); while (m_WebBrowser.ReadyState! = WebBrowserReadyState. complete) Application. doEvents (); m_WebBrowser.Dispose ();} private void WebBrowser_DocumentCompleted (object sender, expose e) {WebBrowser m_WebBrowser = (WebBrowser) sender; m_WebBrowser.ClientSize = new Size (this. m_BrowserWidth, this. m_BrowserHeight); bytes = false; m_Bitmap = new Bitmap (values, values); values (m_Bitmap, m_WebBrowser.Bounds); m_Bitmap = (Bitmap) values (m_ThumbnailWidth, m_ThumbnailHeight, null, IntPtr. zero) ;}} Bitmap m_Bitmap = WebSiteThumbnail. getWebSiteThumbnail ("here is the html connection address", 990,279 8, 990,279 8); MemoryStream MS = new MemoryStream (); m_Bitmap.Save (MS, System. drawing. imaging. imageFormat. png); // JPG, GIF, and PNG can all be byte [] buff = ms. toArray (); Response. binaryWrite (buff); System. drawing. image img = byteArrayToImage (buff); string url = "Image save .png"; img. save (HttpContext. current. server. mapPath (url ));

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.