Results 1 to 15 of 15

Thread: Create thumbnail FILE

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14

    Question

    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]

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Use a picturebox and stretch it with StretchBlt or PaintPicture. Then you can save it like this:
    Code:
    SavePicture Picture1.Image, "C:\x.bmp"

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    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]

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    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?

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    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???



  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    I get a invalid use of proptery.

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  10. #10

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    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



  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  12. #12

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    I have tried lots of code, but still doesnt work. Does anyone have an answer.

    Thanks,
    Bryan

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  14. #14

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14
    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

  15. #15

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Memphis, TN, USA
    Posts
    14

    Talking

    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
  •  



Click Here to Expand Forum to Full Width