Hi everyone,
I'm developing a form with .Net, in C++. I have to display a choosen
image on a pic-box and then I have to do some elaborations on it.
I need to get the Image (which I open from a dialog) as an unsigned char
array, some sort of:
image --> unsigned char buffer[]
because I have a whole of algorithms to use that use image-array like that.
I have already displayed the image and converted to Image class, but I dont
know
how to convert it into uchar array.
Thank you and forgive my poor english!

Signature
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
serena
aka
arwen_h
Tom Widmer - 08 Feb 2005 11:50 GMT
> Hi everyone,
> I'm developing a form with .Net, in C++. I have to display a choosen
[quoted text clipped - 9 lines]
>
> Thank you and forgive my poor english!
Bitmap::LockBits seems to be what you want:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/
GDIPlusreference/classes/bitmapclass/bitmapmethods/lockbits.asp
Note that you'll need to make sure that the format of the unsigned chars
is correct. And you need a Bitmap rather than an Image (though Bitmap is
a subclass of Image).
Tom
Sebastian Dau - 08 Feb 2005 13:21 GMT
Try this lines, that should work for C++.NET Image conversion...
System::Drawing::ImageConverter __gc* ic = new
System::Drawing::ImageConverter();
byte[] photo = new byte[1];
try
{
photo = try_cast<byte[]>( ic->ConvertTo(imagen, photo.GetType());
}
catch ( Exception __gc* ex )
{
Debug::WriteLine(er->ToString() );
}
Bye Sebastian Dau
> Hi everyone,
> I'm developing a form with .Net, in C++. I have to display a choosen
[quoted text clipped - 15 lines]
> aka
> arwen_h