Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 66
VBA/SQL - Connect to SQL server and pull data 4 118
Hide vba in gp 7 104
Added a column screws up code 5 63
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

792 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