Saving an image to a file

Discussion in 'Additional Libraries' started by Erel, Apr 29, 2007.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Attached is a small library that allows saving images to bitmap (BMP) files.
    It works from the desktop or the device.
    This library requires .Net Framework 2.
    An example is included in the zip file.

    Attached Files:

  2. derez

    derez Expert Licensed User


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

    Erel Administrator Staff Member Licensed User

    This library requires .Net CF 2.0.
    Otherwise you will receive "Invalid ..." error.
    See the link above for setup instructions.
  4. hung

    hung Member Licensed 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?

  5. Erel

    Erel Administrator Staff Member Licensed User

    You can save the ForeLayer using using Form.FImage.
    It isn't possible to merge the two layers into one image.
  6. hung

    hung Member Licensed User

    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.

  7. Erel

    Erel Administrator Staff Member Licensed User

    Sorry but as you've wrote there is no FImage.
    How are you drawing the forelayer on on the back layer?
  8. hung

    hung Member Licensed User

    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.
  9. bdiscount

    bdiscount Active Member Licensed User

    How can I save a portion of the image.
  10. hung

    hung Member Licensed User

    Hi, Erel

    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?

  11. Erel

    Erel Administrator Staff Member Licensed User

  12. klaus

    klaus Expert Licensed 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.
  13. hung

    hung Member Licensed User

    Seems that is the only way. Thanks Klaus & Erel.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice