Trying to download huge image parts

wildjack

Client
Регистрация
19.07.2013
Сообщения
93
Благодарностей
8
Баллы
8
i tried the code working well on other sites but not there

HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
int heHeight = Convert.ToInt32(he.GetAttribute("height"));
int heWidth = Convert.ToInt32(he.GetAttribute("width"));
int step =1000;
int countOfIterations = heHeight/step;
var bitmaps = new List<System.Drawing.Bitmap>();
int count =0;
for(int i =0;i<countOfIterations;i++)
{
var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+i.ToString()+@".jpg");
count++;
}
int lastPieceHeight = heHeight%step;
if (lastPieceHeight>10)
{
var text = he.DrawPartToBitmap(0, heHeight-lastPieceHeight, heWidth, lastPieceHeight, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+count.ToString()+@".jpg");
}
 

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
It's definitely a rum-sized image! :o

Have you tried free online image editors like this one? (can split, etc). If that doesn't work, there's others that might perform the job.
 
  • Спасибо
Реакции: wildjack

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
  • Спасибо
Реакции: richim1

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)