change image pixels

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
is it possible to change image pixels that i'm uploading, I would like to be able to randomize them so they're not detected as the same image
 

Radzhab

Client
Регистрация
23.05.2014
Сообщения
1 500
Благодарностей
1 264
Баллы
113

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
788
Баллы
113
if you know c# you can modify this snippet
Код:
//Reduse image with saving its proportion
Func<System.Drawing.Image, int, int, System.Drawing.Image> imgReduse = (System.Drawing.Image _img, int _width, int _height) => {
    var _rx = (double)_img.Width/_width;
    var _ry = (double)_img.Height/_height;
    var _ratio = Math.Min(_rx, _ry);
    var _newW = (int)(_img.Width/_ratio);
    var _newH = (int)(_img.Height/_ratio);
    return new System.Drawing.Bitmap(_img, _newW, _newH);
};

string imagePath = @"D:\downloads\photo_51465.jpg";
// Create image file
System.Drawing.Image tempimg =  System.Drawing.Image.FromFile(imagePath);
System.Drawing.Image img = imgReduse(tempimg, 300, 100);
// Save new image
img.Save(@"D:\downloads\small_photo_51465.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
tempimg.Dispose();
img.Dispose();
don't know what's with the quality if you are going to bigger immage but if reduse, it save the proportion properly.
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
how do i set output picture with variable? i tried using
img.Save(@project.Variables["randompicoutput"].Value);
and i got error:
'peform the csharp own code a generic error occured in GDI+.'

i tried didnt variations of this and get errors regardless...
 
Последнее редактирование:

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 708
Баллы
113
@ is not needed in your case
 

bill

Client
Регистрация
05.07.2014
Сообщения
355
Благодарностей
9
Баллы
18
nevermind got it :D
 
Последнее редактирование:

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