Solved

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

Posted on 2003-11-09
5
683 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

747 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

11 Experts available now in Live!

Get 1:1 Help Now