473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

convert image to array of bytes or InPtr

I'm using OpenGL in Visual Basic .net 2005 and i need to use the following
function

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer to an
image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?

My thanks in advanced

Ricardo Furtado
Dec 11 '07 #1
1 2871
"Ricardo Furtado" <Ri************@discussions.microsoft.comschrieb
I'm using OpenGL in Visual Basic .net 2005 and i need to use the
following function

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer
to an image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?
Have a look at the Bitmap's LockBits function. The Scan0 property of the
returned object might be what you're looking for. I don't know if the
function expects any header.
Armin

Dec 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Swarup | last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling it into a byte arry. Now i have to convert it into a string to store it in the database. I use...
3
by: Sandi | last post by:
I have a simple problem: I have an Access database (images.mdb) that has 2 columns: one is the id if the picture (an integer) and one (column named picture) is a field of type OLE Object which...
7
by: Rob T | last post by:
Hi, I'm trying to convert his line from C# to VB: System.Drawing.Image _img= System.Drawing.Image.FromStream(new System.IO.MemoryStream((byte)SqlReader); I have this so far: dim Img as...
8
by: Ken Dopierala Jr. | last post by:
Hi, I'm reading the header file of a PCX image and I need to convert 2 bytes to a short. How would I go about doing this? I know that they are bytes 8 & 9 in my byte array. I'm not sure how to...
3
by: ShihChengYu | last post by:
Dear all: How to convert color image to bi-level image? I have confronted one problem when I build my OCR project. I used an software API function to enhance my project, but the API only...
8
by: piggy | last post by:
I am trying to convert an image to an byte array (tobytes() method) and from byte array back to an image (frombytes() method). The problem i have here is say the image size is 285 bytes but the...
2
by: orange123 | last post by:
Hi Can someone help me please? (I am doing all this code in VB.NET) I have been trying to convert an existing document (word, excel, pdf, powerpoint, etc) to an image field) in my sql server...
2
by: minouparhizkar | last post by:
hi could anyone helping me to finish this i have no idea how to implement the program in java im trying to grabbing the pixel from image and then convert it to the txt file .i did that but it didnt...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
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...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.