0

i'am developing a wpf application and i need some help here: i have some urls that are stored in a database .i want to display them in an itemscontrol ,i know how to do that but i don't know how to get a preview from the url like this: a sample of what i'am supposed to do

I tried this code but the quality of the image is not that good:

 WebsitesScreenshot.WebsitesScreenshot _Obj;
            _Obj = new WebsitesScreenshot.WebsitesScreenshot();
            WebsitesScreenshot.WebsitesScreenshot.Result _Result;
            _Result = _Obj.CaptureWebpage("http://www.codeproject.com/");
            if (_Result == WebsitesScreenshot.
                WebsitesScreenshot.Result.Captured)
            {
                _Obj.PreserveAspectRatio = true;
                _Obj.ImageWidth = 200;
                _Obj.ImageHeight = 300;
                _Obj.ImageFormat = WebsitesScreenshot.
        WebsitesScreenshot.ImageFormats.JPG;
                _Obj.SaveImage("D:\\WebpageThumbnailer.jpg");
                //_Obj.
            }
            _Obj.Dispose();
Rami Raddaoui
  • 75
  • 1
  • 5
  • 12

1 Answers1

0

In your case, try this code

                WebsitesScreenshot.WebsitesScreenshot _Obj;
                _Obj = new WebsitesScreenshot.WebsitesScreenshot();
                WebsitesScreenshot.WebsitesScreenshot.Result _Result;
                _Result = _Obj.CaptureWebpage("http://www.codeproject.com/");
                if (_Result == WebsitesScreenshot.
                    WebsitesScreenshot.Result.Captured)
                {
                    _Obj.PreserveAspectRatio = true;
                    _Obj.ImageWidth = 200;
                    _Obj.ImageHeight = 300;
                    _Obj.JpegQuality = 80;//here you set numbers from 1 to 100
                    _Obj.ImageFormat = WebsitesScreenshot.
            WebsitesScreenshot.ImageFormats.JPG;
                    _Obj.SaveImage("D:\\WebpageThumbnailer.jpg");
                    //_Obj.
                }
                _Obj.Dispose();
Suhail Mumtaz Awan
  • 3,084
  • 7
  • 40
  • 73