?
Solved

How to form a Bitmap file?

Posted on 1999-01-14
7
Medium Priority
?
163 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 200 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
Independent Software Vendors: 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses

777 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