Advertisement
Guest User

catpcha1z

a guest
Oct 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
  2. int heHeight = Convert.ToInt32(he.GetAttribute("height"));
  3. int heWidth = Convert.ToInt32(he.GetAttribute("width"));
  4. int step =1000;
  5. int countOfIterations = heHeight/step;
  6. var bitmaps = new List<System.Drawing.Bitmap>();
  7. int count =0;
  8. for(int i =0;i<countOfIterations;i++)
  9. {
  10. var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
  11. byte[] imageBytes = Convert.FromBase64String(text);
  12. var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
  13. var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
  14. img.Save(@"C:\images\part"+i.ToString()+@".jpg");
  15. count++;
  16. }
  17. int lastPieceHeight = heHeight%step;
  18. if (lastPieceHeight>10)
  19. {
  20. var text = he.DrawPartToBitmap(0, heHeight-lastPieceHeight, heWidth, lastPieceHeight, true);
  21. byte[] imageBytes = Convert.FromBase64String(text);
  22. var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
  23. var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
  24. img.Save(@"C:\images\part"+count.ToString()+@".jpg");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement