Results 1 to 26 of 26

Thread: Saving Images

  1. #1

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Arrow Saving Images

    Lets say I have a picturebox. I created a line in the picturebox useing: line(0,0)-(400,300) or something like that. How would i then save what the picturebox is showing to a bitmap file?
    My monkey wearing the fedora points and laughs at you.

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    i think it is


    picture1.savepicture?

  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    sorry

    savepicture picture1, "c:\hello.jpg"

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    e.g.

    VB Code:
    1. Private Sub Command1_Click()
    2. SavePicture Picture1, "c:\hello.jpg"
    3. End Sub
    4. Private Sub Form_Load()
    5. Picture1.Picture = LoadPicture("c:\avatar.gif")
    6. End Sub


  5. #5

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Thanks

    Thanks, I know a lot of Visual Basic, but i don't know some of the really easy stuff for some reason.
    My monkey wearing the fedora points and laughs at you.

  6. #6
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    np

    Well you know what they say:
    The more you know, the more u know u don't know

  7. #7

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Ahhh!

    That worked but it only saved the picture that was loaded! I need it to save what is showing on the picturebox.
    PHP Code:
    Private Sub mdiffuse_Click()
    Form2.Caption "VB Effect App-Working..."
        
    For 1 To Picture1.ScaleHeight
            
    For 1 To Picture1.ScaleWidth
            pixval 
    Picture1.Point(Int(Rnd 3), Int(Rnd 3))
            
    Picture1.PSet (ji), pixval
            Next j
        Next i
    Form2
    .Caption "VB Effect App"
    End Sub 
    That is some of my code. When it does that it just covers the picture with points, which aren't saved.
    My monkey wearing the fedora points and laughs at you.

  8. #8
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    picture1.picture = picture1.image
    savepicture picture1, "c:\myfile.jpg"


  9. #9

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Thumbs down ahhhhhhh

    That still didn't work!! Is this even Possible?
    My monkey wearing the fedora points and laughs at you.

  10. #10
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    yeah, that should work

    i'm off to bed, tell me if it's not fixed (tomorrow)

  11. #11
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    perhaps i'll just handball this q on, post it in the games and graphics forum, those guys will surely know how to do it

  12. #12
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Try this:

    VB Code:
    1. SavePicture Picture1.Image, "C:\mypic.bmp"

    Baaaaaaaaah

  13. #13

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    Thumbs down Tried

    I already tried that. picture1.image is only the picture source and not all of what the picturebox is showing.
    picture1.image is same as picture1.picture
    My monkey wearing the fedora points and laughs at you.

  14. #14
    DaoK
    Guest
    For i = 1 To Picture1.ScaleHeight
    For j = 1 To Picture1.ScaleWidth
    pixval = Picture1.Point(j + Int(Rnd * 3), i + Int(Rnd * 3))
    Picture1.PSet (j, i), pixval
    Next j
    Next i
    It show nothing in the picture box .... ?

  15. #15

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423
    I've already got this problem fixed about saving. And for that code above, load a picture first
    My monkey wearing the fedora points and laughs at you.

  16. #16
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    how did u do it in the end?

  17. #17
    DaoK
    Guest
    What is the answer because I want to know.

  18. #18
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    I've already asked him DaoK, so there is no point for you to ask as well

  19. #19
    DaoK
    Guest
    Your noyt my father so keep your suggestion to yourself

  20. #20
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    you're posting crap so why don't u shutup

  21. #21
    DaoK
    Guest
    You post crap so shh

  22. #22
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    No i don't

    I post more answers than you!

  23. #23
    Frenzied Member JungleMan's Avatar
    Join Date
    Feb 2001
    Posts
    2,033
    I dont post nearly as many answers as you!
    I'm bringing geeky back...

  24. #24
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    For an actual answer to this q:

    You can save Form.Image using the X,Y coords (Left, Top) of the picturebox you want, and the .Width, .Height of the PictureBox.

    This should work - I have tried it successfully.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  25. #25
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Re: Tried

    Originally posted by Arrow_Raider
    I already tried that. picture1.image is only the picture source and not all of what the picturebox is showing.
    picture1.image is same as picture1.picture
    I am just curious why it's not working. That code will save whatever is drawn on the picture box(not only the image loaded in it).
    I have tried it myself and it works fine.
    Baaaaaaaaah

  26. #26
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    This works for me:

    VB Code:
    1. Private Sub Command1_Click()
    2.     Picture1.AutoRedraw = True
    3.     Picture1.Line (0, 0)-(1000, 1000), vbBlack
    4.     SavePicture Picture1.Image, "c:\tt.bmp"
    5.     Picture2.Picture = LoadPicture("c:\tt.bmp")
    6. End Sub

    -Lou

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width