digb
asked on
Saving pictures outside of the program
Is there a way i can save an array of pictures outside the program?
I have thought about using a resource file or picclip, but i am not sure how to save these files outside of my exe.
Any Ideas how i could?
Digb
I have thought about using a resource file or picclip, but i am not sure how to save these files outside of my exe.
Any Ideas how i could?
Digb
ASKER
Ok!
I have a picturebox where a user draws into.
as soon as the user stops (mouse_up), the picture is saved into an array. There is a command button to add new pictures, but each new picture is saved into an array.
I use the array to create animations by having a different picturebox slowly change pictures by increasing the number value of the array.
But as soon as the user quits the program, the array is resetted and the array is lost. I want to save the array and all the pictures inside it, into one file (not using save picture since it would create lots of pictures). I know bitmaps can be accessed from a resource file (.res) but i'm unsure of how to save them to it. I also know many images can go into a picclip but am unsure how it's possible to save that file, without having it being saved to the form. (ie instead of saving text to a textbox, i'd rather it became a .txt)
I have a picturebox where a user draws into.
as soon as the user stops (mouse_up), the picture is saved into an array. There is a command button to add new pictures, but each new picture is saved into an array.
I use the array to create animations by having a different picturebox slowly change pictures by increasing the number value of the array.
But as soon as the user quits the program, the array is resetted and the array is lost. I want to save the array and all the pictures inside it, into one file (not using save picture since it would create lots of pictures). I know bitmaps can be accessed from a resource file (.res) but i'm unsure of how to save them to it. I also know many images can go into a picclip but am unsure how it's possible to save that file, without having it being saved to the form. (ie instead of saving text to a textbox, i'd rather it became a .txt)
You have to create a resource file. In VB5 there is no direct way of doing it. However, you can create a resource file using VC++ version 5 or higher.
A resource file can contain all the pictures and bitmaps needed to your project and it will significantly drop the size of your exe file.
Give me a yell if you need more help.
A resource file can contain all the pictures and bitmaps needed to your project and it will significantly drop the size of your exe file.
Give me a yell if you need more help.
ASKER
Oh, really? Hmm, I don't think I can afford to change to VC++ this late in the game, my deadline is quickly approaching...
Is there a way I can use picclip then?
TIA
Is there a way I can use picclip then?
TIA
You only use VC++ to create the resource file.
ASKER
I need the user to be able to save the resource file not the programmer.
I want the user to be able to save his work.
I want the user to be able to save his work.
I am sorry I can not help you but I suggest that you save different bitmaps and save a map file to these bitmaps, map file could be an ascii file that specify where are your bitmaps.
Regards
Regards
ASKER
thanks neway!
I suggeest the following:
First, you have to know how many pictures would you like to save into this single file. Lets say, for example 10.
Let's say your Picture box is 50 x 50 pixels.
Then you could dynamically create PictureBox that is 10 times the width of the original (500 x 50 pixels), then you use the BitBlt API function to paste each one of the bitmaps on the HUGE bitmap, and finally you use the SavePicture method to save the 10 bitmaps on a single file.
First, you have to know how many pictures would you like to save into this single file. Lets say, for example 10.
Let's say your Picture box is 50 x 50 pixels.
Then you could dynamically create PictureBox that is 10 times the width of the original (500 x 50 pixels), then you use the BitBlt API function to paste each one of the bitmaps on the HUGE bitmap, and finally you use the SavePicture method to save the 10 bitmaps on a single file.
The res files are embeded into the exe file at compilation.
You could also save the bitmaps in a Database.
You could also save the bitmaps in a Database.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you liked that solution.
ASKER
i'll like it better if someone tells me how to use a ole
chart to save pics...
:)
chart to save pics...
:)
If everything were an OLE answer we'd fast run out of a need for the ingenious, original programmer now wouldn't we?
:)
:)
ASKER
well yes...
but that still leaves me with an array of pics i cannot save...
;)
but that still leaves me with an array of pics i cannot save...
;)
Using that routine, you have saved an array of pictures, if you wanted to make it a dll and instantiate it from within other programs you could do that as well. It just isn't a nice little pre-packaged routine for you yet, you are going to make it the nice pre-packaged routine for others later.
ASKER
any chance anyone has a sample program illustrating this?
Take that code that I posted here and place it in it's own Activex dll project, name it PicSaver or whatever you like.
Make a public function named SavePic or whatever and allow an array of pictures to
be passed in to it.
Have an inverse Sub named LoadPic and have it's return type be an array of pictures.
Compile this project, this will make it into a dll.
Whenever you want to use it's functionality, add it to a project's project references and then use early binding and set a new object of type PicSaver to instantiate it, you can then use its Savepic or LoadPic methods to do your storage and retrieval.
Make a public function named SavePic or whatever and allow an array of pictures to
be passed in to it.
Have an inverse Sub named LoadPic and have it's return type be an array of pictures.
Compile this project, this will make it into a dll.
Whenever you want to use it's functionality, add it to a project's project references and then use early binding and set a new object of type PicSaver to instantiate it, you can then use its Savepic or LoadPic methods to do your storage and retrieval.
ASKER
Sounds Good... cept
for saving it byte by byte,
where does the trail bytes and lead bytes get saved to?
for saving it byte by byte,
where does the trail bytes and lead bytes get saved to?
You save the lead and trail bytes out to file as well, you convert their hex values to byte values (x'FF = 255, x'00 = 0, etc) and then convert them to hex for the comparison when you read them back in.
ASKER
That sounds extremely complicated...
It sounds rough, but once you get the concept and you work on it a little bit, it's not a bad deal at all. When you get done with this you will understand the bits and bytes of what you are doing, if you don't want to think about it in hex terms, just save byte values out to disk that you will use later, instead of thinking about it as x'FF00AA55 or whatever, just save out four bytes - 255, 0, 170, 85. Then when you read in the bytes off of the disk check the value of each byte, (Somewhere between 0 and 255). Write a routine to detect that byte value sequence after each byte is read in.
.
Could you explain more...