here is my code, I was trying to convert arraybyte to bitmap after placing some value in array and convert it back to bitmap, actually i'm working with bilinear interpolation. i really appreciate that if u can show me the right code to convert array to bitmap.(the code that in italic).
regards, mickle - int[,] arrayImage1 = new int [pictureBox1.Image.Height, pictureBox1.Image.Width];
-
int[,] arrayImage2 = new int[pictureBox1.Image.Height, pictureBox1.Image.Width];
-
Bitmap newbitmap = new Bitmap(pictureBox1.Image.Height, pictureBox1.Image.Width);
-
for (int i = 0; i < pictureBox1.Image.Height; i++) //y axis
-
{
-
for (int j = 0; j < pictureBox1.Image.Width; j++) //x axis
-
{
-
Color image1 = redbitmap2.GetPixel(j, i);
-
Color image2 = bluebitmap2.GetPixel(j, i);
-
-
byte ColorByteImage1 = RGB(image1);
-
arrayImage1[j, i] = ColorByteImage1;
-
byte ColorByteImage2 = RGB(image2);
-
arrayImage2[j, i] = ColorByteImage2;
-
-
if (arrayImage1[j, i] != arrayImage2[j, i])
-
{
-
-
int B1 = arrayImage1[j+1, i];
-
int B2 = arrayImage1[j-1, i];
-
int B3 = arrayImage1[j, i+1];
-
int B4 = arrayImage1[j, i-1];
-
-
int array = (B1 + B2 + B3 + B4)/4;
-
arrayImage1[j, i] = array;
-
}
-
-
}
-
}
-
- TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap));
-
Bitmap newbitmap1 = (Bitmap)tc.ConvertFrom(arrayImage1);
-
pictureBox3.Image = newbitmap;
-
//RGB uint
-
private byte RGB(Color color)
-
{
-
// Format the value of color - 0x00bbggrr
-
return ((byte)(((byte)(color.R) | ((byte)(color.G) << 8)) | (((byte)(color.B)) << 16)));
-
-
}
1 2667 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Eka Gautama |
last post by:
Hi all,
I need help for a sample code to convert a bitmap to byte as well from byte
to bitmap..
Thanks for the help
Eka
|
by: News VS.NET \( MS ILM \) |
last post by:
Hello
I have the following:
Dim myBitmap As New Bitmap(600, 500)
Q:
How to convert a Bitmap to a Buffer() of Bytes
|
by: James Dean |
last post by:
I have 1 bit per pixel information and i have the width and height of
this data.Each bit corresponds to a 24 bit colour value. I want to
convert this to 24bit per pixel bitmap.
Do i need to...
|
by: Dennis |
last post by:
I am trying to convert a bitmap to a JPEG MemoryStream and return a Byte
array containing the resulting JPEG Image as follows:
Public Function BmpToJPEG(ByVal BitMapIn As Bitmap, ByVal Quality As...
|
by: Wolfgang Hauer |
last post by:
Hallo!
Ich habe eine inmemory-bitmap. die ich leider in eine png-datei umwandeln
muss.
ich mache das jetzzt so:
b = New...
|
by: =?Utf-8?B?UHJ6ZW1v?= |
last post by:
Hi,
I would like to have a web service method sending a bitmap image. But code
like do not work:
<WebMethod()_
Public Function GetBitmap() As Drawing.Bitmap
Dim a As New...
|
by: stef |
last post by:
hello
I can find all kind of procedures to convert an array to a bitmap
(wxPython, PIL),
but I can't find the reverse,
either
- convert a bitmap to an array
or
- read a bitmap file to an...
|
by: Smokey Grindel |
last post by:
when I do this code
Dim HIcon As IntPtr = bmp.GetHicon to convert a Bitmap which is just a 16x16
image I pulled from a resource originally as an icon (16x16x32bit) then
converted into a bitmap to...
|
by: deluxmilkman |
last post by:
hi
I know I can convert a mc to a bitmap with "cacheAsBitmap".
Now I am wondering how I can convert a bitmap to a mc.
I have a black and white bitmap, which I created from a vide still.
now I...
|
by: Bill Fuller |
last post by:
I have a Bitmap (bm) that I am able to save using, for example,
bm.Save("file.jpg", System.Drawing.Imaging.ImageFormat.Jpeg). However, I
would like to convert this to a byte array (byte). What is...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |