Solved

Urgent! Save a bitmap Image from PictureBox as a .bmp file

Posted on 2003-11-09
5
685 Views
Last Modified: 2010-05-01
HI guys,

In my application, there is a provision for user to select bitmap images and show them in picturebox. Now I want to save that image in .bmp file.

I can copy that file from selected location but I want to save that image from PictureBox.

I got one example on using MemoryBitmap. But it stores everything in byte array so for bigger images it is slow and very very resource consuming which affects my application performance.

Please guide me with APIs/special logic/builtin vb functions etc.


Thanks
Anand.
0
Comment
Question by:anand2k
5 Comments
 
LVL 3

Assisted Solution

by:monvelasquez
monvelasquez earned 50 total points
ID: 9712469
Use the SavePicture Function

assuming the name of the picture control in Picture1

SavePicture Picture1.Picture, "filename.bmp"

0
 
LVL 1

Author Comment

by:anand2k
ID: 9712577
Hello monvelasquez

Yes, SavePicture is a method to save the picture from pacturebox.

but, i have not explained the question properly. I applogies for that.

I want a logic/API by which i can save the bitmap but i want to keep the header of bitmap apart and actual image in file.

In details - in my app there will be number of images say 10, but i will keep the images in 2 files only.
File 1 wil keep headers appended one after one.
FIle2 will keep actual Image, appended one after other.

I know this is very tedious way to do, but my app required that.

I hope, I have explained neatly now.

Thx
Anand
0
 
LVL 5

Accepted Solution

by:
WorkingJourneyman earned 50 total points
ID: 9714268
1. Save bitmap image to temporary file
2. Open temporary file
3. Read bitmap header and store in file1 (headers)
4. Read bitmap data and store in file2 (images)
5. Close and delete temporary file

The format of a bitmap file is documented here: http://msdn.microsoft.com/library/en-us/gdi/bitmaps_4v1h.asp

It may be helpful to store the offset of a bitmap's image data along with the bitmap header in file1.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9714700
hearing...
0
 
LVL 1

Author Comment

by:anand2k
ID: 9796040
THx guys,

I m sure, I have justified both

Many THx


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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 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

18 Experts available now in Live!

Get 1:1 Help Now