|
-
Dec 15th, 2001, 11:08 AM
#1
Thread Starter
Hyperactive Member
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.
-
Dec 15th, 2001, 11:18 AM
#2
Conquistador
i think it is
picture1.savepicture?
-
Dec 15th, 2001, 11:19 AM
#3
Conquistador
sorry
savepicture picture1, "c:\hello.jpg"
-
Dec 15th, 2001, 11:21 AM
#4
Conquistador
e.g.
VB Code:
Private Sub Command1_Click()
SavePicture Picture1, "c:\hello.jpg"
End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture("c:\avatar.gif")
End Sub
-
Dec 15th, 2001, 11:25 AM
#5
Thread Starter
Hyperactive Member
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.
-
Dec 15th, 2001, 11:27 AM
#6
Conquistador
np
Well you know what they say:
The more you know, the more u know u don't know
-
Dec 15th, 2001, 11:33 AM
#7
Thread Starter
Hyperactive Member
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 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
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.
-
Dec 15th, 2001, 11:38 AM
#8
Conquistador
picture1.picture = picture1.image
savepicture picture1, "c:\myfile.jpg"
-
Dec 15th, 2001, 11:48 AM
#9
Thread Starter
Hyperactive Member
-
Dec 15th, 2001, 11:56 AM
#10
Conquistador
yeah, that should work
i'm off to bed, tell me if it's not fixed (tomorrow)
-
Dec 15th, 2001, 12:00 PM
#11
Conquistador
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
-
Dec 15th, 2001, 12:42 PM
#12
PowerPoster
Try this:
VB Code:
SavePicture Picture1.Image, "C:\mypic.bmp"
-
Dec 15th, 2001, 01:08 PM
#13
Thread Starter
Hyperactive Member
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.
-
Dec 15th, 2001, 08:51 PM
#14
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 .... ?
-
Dec 15th, 2001, 08:54 PM
#15
Thread Starter
Hyperactive Member
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.
-
Dec 15th, 2001, 10:51 PM
#16
Conquistador
how did u do it in the end?
-
Dec 16th, 2001, 10:31 AM
#17
What is the answer because I want to know.
-
Dec 16th, 2001, 04:09 PM
#18
Conquistador
I've already asked him DaoK, so there is no point for you to ask as well
-
Dec 16th, 2001, 04:14 PM
#19
Your noyt my father so keep your suggestion to yourself
-
Dec 16th, 2001, 04:19 PM
#20
Conquistador
you're posting crap so why don't u shutup
-
Dec 16th, 2001, 04:29 PM
#21
-
Dec 16th, 2001, 04:32 PM
#22
Conquistador
No i don't
I post more answers than you!
-
Dec 16th, 2001, 07:10 PM
#23
Frenzied Member
I dont post nearly as many answers as you!
I'm bringing geeky back...
-
Dec 16th, 2001, 11:27 PM
#24
PowerPoster
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]
-----------------------------------------
-
Dec 16th, 2001, 11:57 PM
#25
PowerPoster
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.
-
Dec 17th, 2001, 03:25 PM
#26
This works for me:
VB Code:
Private Sub Command1_Click()
Picture1.AutoRedraw = True
Picture1.Line (0, 0)-(1000, 1000), vbBlack
SavePicture Picture1.Image, "c:\tt.bmp"
Picture2.Picture = LoadPicture("c:\tt.bmp")
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|