Solved

How to form a Bitmap file?

Posted on 1999-01-14
7
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maro to copy and paste from one worksheet to another based on a condition 11 70
Copy a row 12 75
vb6 connector to mongodb 2 161
checkbox to hide entire section 10 75
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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

734 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