Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…
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…

776 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