Solved

How to form a Bitmap file?

Posted on 1999-01-14
7
158 Views
Last Modified: 2010-05-03
Currently I have keep all the pixel data in an integer array (gray scale 0 to 255(PGM format)).wondering any one teach me how to create a Bitmap image file with the array?
0
Comment
Question by:nigelcct
  • 4
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1456155
The easiest way is to put it on a picturebox, and use SavePicture to save it to disk. You can also go to www.wotsit.org, and get the BMP file specifications. You can probobly find some source code as well, but it will be for C
0
 
LVL 4

Expert Comment

by:chabaud
ID: 1456156
I have a small sample with pure VB code, if you want...
0
 

Author Comment

by:nigelcct
ID: 1456157
Thank for your help..
   wonder  you know how to form a Bitmap??
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:chabaud
ID: 1456158
I'll give you a complete sample if you reject the small MikeP answer. (i mean small for the answer !)
0
 

Author Comment

by:nigelcct
ID: 1456159
Yes please.. Can I have it?? can you email me
nigelcct@singnet.com.sg
Thanks
0
 
LVL 4

Expert Comment

by:chabaud
ID: 1456160
Create a new form with one picturebox and one commandbutton, and test this:

Option Explicit

Private Sub Form_Load()
    Me.ScaleMode = vbPixels
    Picture1.ScaleMode = vbPixels
End Sub

Private Sub Command1_Click()
    Dim c As Long
    Dim i As Integer
    Dim j As Integer
   
    Picture1.Visible = False
   
    For i = 0 To Picture1.Width
        For j = 0 To Picture1.Height
            'for your pb change next line to: c = YourTab(i,j)
            c = Rnd * 256
            Picture1.PSet (i, j), RGB(c, c, c)
        Next
    Next
   
    SavePicture Picture1.Image, "theFile.bmp"
End Sub

0
 
LVL 4

Expert Comment

by:chabaud
ID: 1456161
In the code, your can remove this line to view the picture...
Picture1.Visible = False

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now