Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving an image to a file 1

Status
Not open for further replies.

modalman

Programmer
Feb 14, 2001
156
GB
Hi. I've created a form with an image placed in a picture box. Is there a way of saving that image as a file to the hard drive? Many thanks in advance.

ASCII silly question, get a silly ANSI
 
If you've loaded an image into an image box on your form, then is it not already on your hard drive??

When you loaded the image you use Loadpicture, if you want to copy it to a different place, use the FileCopy Function.

If i'm not reading into this enough, please tell me and will try and help more, try and give me a better explanation tho'. Thx.

Hope it helps,

P.S. Like the signature...

jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
Yes the image is on my hard drive but others need to run the program which will then place the image on their drive. The program is to set up email stationery. A user will download it from a website, enter their email address and email signature and then the program will generate an html file and a couple of images in their stationery folder. Thats the theory anyway. I'm just stuck on extracting the images to the stationery folder. They are gifs as well just to complicate things.


ASCII silly question, get a silly ANSI
 
KO, you can use the following statement, but as far as I am aware this can only save in BMP format (maybe a couple of other windows formats)

On the upside, even if the picture loaded is in a different format (GIF, JPG etc) it will convert these quite happily..

Private Sub cmdSaveImage_Click()
SavePicture imgMyImage.Picture, "C:\MySavedPic.BMP"
End Sub

Hope this helps.

jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
Thanks Jag. That works well. Unfortunately I do need the image as a gif.

Plan B. Is there some sort of self extractor program that will automatically extract my stationery pics, html and an exe and then run the exe?

ASCII silly question, get a silly ANSI
 
Modalman,

Before Plan B, you should know why VB can't write to GIF files, see for information.

Now, on to Plan B, You have two options.

Use a self extractor such as Winzip SE, or InstallShield.

Use a VB EXE Packer Called Stand Alone Express (Digit's Software, I'm always recommending it!). This packs your exe, and all necessary Libraries and Controls into one Compressed EXE so you only need to distribute the one EXE.
You can also add any files you want to this exe, and they will be installed in a location of your choice when it is run. Be wary of adding BMP or other large files though, as the size of the exe can go up considerably.!!


is the link to download SAX, i've written a review on this site too.!

Hope this helps.

jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
Thanks Jag. Thats perfect.

ASCII silly question, get a silly ANSI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top