|
-
May 4th, 2000, 09:58 PM
#1
Thread Starter
New Member
Hi, I have a Image control that already resizes my image to the desired thumbnail prepositions.
But now I need to know how to take that image and save it to a file with those dimensions.
Everything I try, I just keep resaves it like it was before I resized it.
If you can help, please do!
[Edited by Bryan on 05-05-2000 at 03:25 PM]
-
May 4th, 2000, 11:59 PM
#2
PowerPoster
Use a picturebox and stretch it with StretchBlt or PaintPicture. Then you can save it like this:
Code:
SavePicture Picture1.Image, "C:\x.bmp"
-
May 5th, 2000, 12:12 AM
#3
Thread Starter
New Member
I have never used either of those. This is what I have tried and it doesnt seem to work.
Code:
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
SavePicture picSave.Image, App.Path & "\temp.bmp"
When I veiw the image I get a blank box, but its the right width and height.
Can you tell me what I am doing wrong?
[Edited by Bryan on 05-05-2000 at 01:24 PM]
-
May 5th, 2000, 02:02 AM
#4
transcendental analytic
First, don't use stretchblt, its slower than paintpicture.
I havent seen your app Bryan, but i thinks it's the same old problem people gets when they use pictures.
Just set the image property to the picture property before you handle the picture with paintpicture. Also, save the picture instead of the image.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 5th, 2000, 02:14 AM
#5
Thread Starter
New Member
Ok, now this is the code I am using, and this is what I am getting.
I have already set imgPreview and resized it and everything shows up fine.
Then I call this code to create the thumbnial.
Code:
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
SavePicture picSave.Picture, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
returns:
Code:
? imgPreview.Picture
3002
?picSave.Picture
0
I have no clue what to do to fix this?
-
May 5th, 2000, 02:35 AM
#6
Thread Starter
New Member
Ok, I have changed my code a tad. But it still doesnt work.
Code:
Dim BorderHt As Integer, BorderWd As Integer
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
BorderWd = picSave.Width - picSave.ScaleWidth
BorderHt = picSave.Height - picSave.ScaleHeight
picSave.Move picSave.Left, picSave.Top, imgPreview.Width + BorderWd, imgPreview.Height + BorderHt
SavePicture picSave.Image, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
This are the results..
Code:
? imgPreview.Picture
16886
? picSave.Picture
0
? picSave.Image
3002
Any ideas??? 
-
May 5th, 2000, 02:55 AM
#7
transcendental analytic
picsave.image=picsave.picture
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 5th, 2000, 02:57 AM
#8
Thread Starter
New Member
I get a invalid use of proptery.
-
May 5th, 2000, 03:33 AM
#9
transcendental analytic
sorry, damn how stupid can i be! Put the other way round
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 8th, 2000, 01:11 AM
#10
Thread Starter
New Member
Ok, here is all of the code, and when it runs, I get a Grey box as the .bmp file, the only thing that seems right is the proportions.
Code:
Private Sub SaveThumbnail()
Dim BorderHt As Integer, BorderWd As Integer
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
BorderWd = picSave.Width - picSave.ScaleWidth
BorderHt = picSave.Height - picSave.ScaleHeight
picSave.Move picSave.Left, picSave.Top, imgPreview.Width + BorderWd, imgPreview.Height + BorderHt
picSave.Picture = picSave.Image
SavePicture picSave.Image, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
End Sub
These are my immediate's:
Code:
? imgPreview.Picture
16906
? picSave.Image
6194
? picSave.Picture
17978
Please can someone help me figure this out?
Thanks
--Bryan
-
May 8th, 2000, 03:21 AM
#11
transcendental analytic
Code:
Private Sub SaveThumbnail()
Dim BorderHt As Integer, BorderWd As Integer
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
BorderWd = picSave.Width - picSave.ScaleWidth
BorderHt = picSave.Height - picSave.ScaleHeight
picSave.Move picSave.Left, picSave.Top, imgPreview.Width + BorderWd, imgPreview.Height + BorderHt
SavePicture picSave.Picture, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
End Sub
[Edited by kedaman on 05-09-2000 at 01:42 AM]
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 9th, 2000, 12:51 AM
#12
Thread Starter
New Member
I have tried lots of code, but still doesnt work. Does anyone have an answer.
Thanks,
Bryan
-
May 9th, 2000, 04:45 AM
#13
transcendental analytic
In properties > picasve put AutoRedraw = True
Code:
Private Sub SaveThumbnail()
picsave.PaintPicture imgpreview.Picture, 0, 0, picsave.Width, picsave.Height, 0, 0, imgpreview.Width, imgpreview.Height 'Resize
SavePicture picsave.Picture, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 9th, 2000, 09:51 PM
#14
Thread Starter
New Member
Ok, we are getting somewhere. Now it actually draws something, and I can see something other then a grey box when I look at the image it created. But it only draws the top left corner. Here is the code I am using
Code:
Private Sub SaveThumbnail()
picSave.PaintPicture imgPreview.Picture, 0, 0, picSave.Width, picSave.Height, 0, 0, imgPreview.Width, imgPreview.Height 'Resize
SavePicture picSave.Image, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
End Sub
-
May 9th, 2000, 09:56 PM
#15
Thread Starter
New Member
Ok, I got it. This is what I had to do.
Set the picSave AutoRedraw to True, then I used this code:
Code:
Private Sub SaveThumbnail()
'Set picSave's height and width
picSave.Width = imgPreview.Width
picSave.Height = imgPreview.Height
'Clear picSave
picSave.Picture = LoadPicture()
'Copy Image to picSave
picSave.PaintPicture imgPreview.Picture, 0, 0, imgPreview.Width, imgPreview.Height
'Save Picture
SavePicture picSave.Image, App.Path & "\thumbnail\" & cmbName.Text & "th.bmp"
End Sub
And it works! Thanks for all the help everyone!!!
[Edited by Bryan on 05-10-2000 at 12:00 PM]
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
|