Image size

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
guys, is there any simple code to check image size ? and put them to variable?;>
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 106
Баллы
113
  • Спасибо
Реакции: Leszek1

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
i'v got somethings wrong, i use :

string filePath = project.Variables["zdjecie_1"].Value;
Image img = Image.FromFile(filePath);
return img.Size;

Where the file is in *.jpg , and directions C:/1.jpg, i can't get the size
 
Последнее редактирование:

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 106
Баллы
113
  • Спасибо
Реакции: Leszek1

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
hah, i was start writing that i know that, make it and still nothing, but i write that self not copy one more time , and now it works, i thing i use in directory " C:/1.jpg" , the correct is "C:\1.jpg" just that, sorry ,

Ofcorse it works ,and thanks for u , hmm the result is : {Width=3660, Height=2760} how now to calculate size??

I need to get just that img size ( jpg ) :( , i think it's imposible to get that img size using his Width and Height ...

Maybe better to write a normal funcion to read size file ( not a specify img size) ??
 
Последнее редактирование:
  • Спасибо
Реакции: Dimionix

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
I found in ru forum that :

string path = project.Variables["file"].Value; // переменная пути к файлу
long fileBytes = long.Parse(project.Variables["fileBytes"].Value); // переменная размера файла в байтах

but that not work.
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 106
Баллы
113
C#:
string filePath = project.Variables["filePath"].Value; // file path
return new FileInfo(filePath).Length; // get the file size in bytes
 
  • Спасибо
Реакции: Leszek1

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
Oh ya !!! Thats works well :-) thank u very much !!! nice work.
 
  • Спасибо
Реакции: Dimionix

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