Here: http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx
An example of using the WebBrowser.DrawToBitmap method.
Once you have created the bitmap, you can compress it using whatever encoding you want.
This is an example from MSDN for how to compress PNG (lossless and small):
A practical guide. Encoding and decoding PNG images
Good luck :)
EDIT:
To get an array of bytes, you can use a memory stream as an output stream.
Here is a working example of how this works:
public static void Main(string[] args) { byte[] test = new byte[] { 2, 5, 6, 1, 9 }; MemoryStream ms = new MemoryStream(); ms.Write(test, 0, 5); byte[] image = new byte[ms.Length]; Buffer.BlockCopy(ms.GetBuffer(), 0, image, 0, (int)ms.Length); for (int i = 0; i < ms.Length; i++) Console.WriteLine(image[i]); Console.ReadKey(); }
And here is an example of how it will work in your case:
public static void Main(string[] args) { MemoryStream ms = new MemoryStream();
Aidiakapi Mar 17 '11 at 10:35 2011-03-17 10:35
source share