Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

Getting image as unsigned char array

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
arwen_h - 08 Feb 2005 10:40 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.