سلام
چطور می توان image ای را که در picturebox است و مسیرش را نمی دانیم به byte[] تبدیل کنیم
اگه می شه کد بذارین چون نمی تونم وقت بزارم
ممنون.
سلام
چطور می توان image ای را که در picturebox است و مسیرش را نمی دانیم به byte[] تبدیل کنیم
اگه می شه کد بذارین چون نمی تونم وقت بزارم
ممنون.
Dim image1 As System.Drawing.Image
image1 = PictureBox1.Image
Dim bitmap1 As New Bitmap(image1)
سلام
تکمیل کد بالا
Dim image1 As System.Drawing.Image
image1 = PictureBox1.Image
Dim bitmap1 As New Bitmap(image1)
Dim h, w, i, j As Integer
h = bitmap1.Height
w = bitmap1.Width
Dim arrA(w, h) As Integer
Dim arrR(w, h) As Integer
Dim arrG(w, h) As Integer
Dim arrB(w, h) As Integer
For i = 0 To w - 1
For j = 0 To h - 1
arrA(i, j) = bitmap1.GetPixel(i, j).A
arrR(i, j) = bitmap1.GetPixel(i, j).R
arrG(i, j) = bitmap1.GetPixel(i, j).G
arrB(i, j) = bitmap1.GetPixel(i, j).B
Next
Next
ممنونم
ولی کسی جور دیگه ای بلد نیست
این کد به نظرم یه جوریه.
ببین این بدرت میخوره
MemoryStream mstr = new MemoryStream();
pictureBox1.Image.Save(mstr, pictureBox1.Image.RawFormat);
byte[] arrImage = mstr.GetBuffer();
یه مثال کوچولو
ImageConverter ic = new ImageConverter();
record.Image = (byte[])ic.ConvertTo(pictureBox1.BackgroundImage, typeof(byte[]));
قفل مخفی تلگرام، واتس اپ و همه برنامه ها - قفل حرفه ای برای دستگاه اندرویدی شما - با امکان مخفی شدن و جلوگیری از Unisntall شدن
--آموزش ایجاد برنامه های چند زبانه در WPF
-BeRMOoDA File Encrypter-open source-using WPF, C# and MVVM Pattern
-نمونه برنامه ساده و کامل با الگوی MVVM برای کار با دیتابیس با استفاده از Entity Framework در WPF
-WPFMessageBox فارسی/انگلیسی - با قابلیت تغییر Skin
در کد زیر Image در یک آرایه ای از جنس Byte بنام b قرار میگیرد
System.IO.MemoryStream ms=new System.IO.MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] b=new byte[ms.Length];
ms.Position = 0;
ms.Read(b, 0, Convert.ToInt32(ms.Length));
سلام ببخشید میشه بگید وقتی تبدیلش کردیم چطور به حالت اول برگردونیم
ســــــــــــــــــــــــ ــلام
اولusing System.IO;
بعد
Image oImage = pictureBox1.Image;
MemoryStream stream=new MemoryStream();
oImage.Save(stream,ImageFormat.Jpeg);
byte[] buffer = stream.ToArray();