Saving an image to a file

derez

Expert
Licensed User
Longtime User
Error

Hi Erel
the attached library reports an error, can you please check and post it again ?
Thanks
David
 

hung

Active Member
Licensed User
Longtime User
Hi Erel,

It seems the imagelibex saves only the background layer but not the forelayer. Any way to save backgound + transparent forelayer in one bmp?

Thanks,
 

hung

Active Member
Licensed User
Longtime User
You can save the ForeLayer using using Form.FImage.
It isn't possible to merge the two layers into one image.

FImage? In Imagelibex?

I have solve the problem by walkaround:
1. save the form1.image to a tmp image
2. use drawer to draw forelayer image to form1 background with transparency
3. save the form1 background
4. draw the tmp image back to form1 background

Not that slow. Make be in next verson u can allow save of background + foreground, or background only, or foregrorund only.

Thanks,
 

hung

Active Member
Licensed User
Longtime User
Sorry but as you've wrote there is no FImage.
How are you drawing the forelayer on on the back layer?

oh. actually i load a image as mask (immask.image) and draw on the forelayer. what i mean draw the forelayer to background is simply draw teh immask.image to background layer.

I don't know how to copy/draw the forelayer to backgound.
 

hung

Active Member
Licensed User
Longtime User
Hi, Erel

oh. actually i load a image as mask (immask.image) and draw on the forelayer. what i mean draw the forelayer to background is simply draw teh immask.image to background layer.

I don't know how to copy/draw the forelayer to backgound.


Hi Erel,

This time the problem is:

I loaded a photo and draw on top a frame all to the from back layer (form.line).
Then most of my new drawings are on forelayer (form.fline).

I want to save image that is form.image, save 2nd image that is forelayer, and save 3rd image that is what are seen on screen (forelayer on top of form.image).

Besides redraw everything on background that I draw on forelayer, any other method?

THanks.
 

klaus

Expert
Licensed User
Longtime User
Here you have an updated version of the the SaveForelayer example:

There is one BitmapEx object for each image with it's DrawerEx:
- bmpBackground holds the background image
- drwBackground allows drawing onto the background image

- bmpForelayer holde the forelayer image
- drwForelayer allows drawing onto the forelayer image

- bmpImage holds the combination of both above images
- drwImage allows drawing onto it

two more DrawerEx objects
- drwMain drawer to draw onto the form's backgound
- drwMainForelayer drawer to draw anto the form's forelayer

Run the program and:
- click on 'Draw on forelayer' draws onto bmpForelayer and copies it to the form's forelayer
- click on 'Erase forelayer' erases the form's forelayer
- click an 'Add forelayer on background' copies both bmpBackground and bmpForelayer on bmpImage

Now you can show on the form all 3 bitmaps.
- Show both shows bmpImage
- Show background shows bmpBackground
- Show forelayer shows the forelayer

You can save the 3 imagaes to files.

Then with 'Transfer both on background' you transfer bmpImage to bmpBackground.

Best regards.
 

hung

Active Member
Licensed User
Longtime User
Seems that is the only way. Thanks Klaus & Erel.
 
Top