Results 1 to 5 of 5

Thread: Resizing an image

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    81

    Talking

    OK fellers, here's an easy question for you. I'm writing a little app at the moment, a small part of which requires the user to load a graphic. However, I would like them to be able to preview the graphic before loading it into the application, by displaying what is effectively a little preview thumbnail. I suspect it may be along the lines of loading the image when they select it and then resizing it and displaying it into a small image box. Is there an easy way, perhaps using BITBLT or whatever, to resize such an image? My worry is that there is NOT an easy way. I'm not too familiar with BITBLT, though I have used it briefly before, so if anybody does provide me with some code, comments would be massively appreciated. Thanks in advance!

    SamDV

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    just load it into a smaller size image control
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    you have to set the stretch property of the image control to true
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Guest
    BltBlt cannot resize images. The API method for that is StretchBlt. In this example, I will use PaintPicture because it's the easiest.

    Put this in a form with a CommonDialog, PictureBox and CommandButton
    Code:
    Private Sub Command1_Click()
        
        CommonDialog1.ShowOpen
        Picture1.PaintPicture LoadPicture(CommonDialog1.filename), _
        0, 0, Picture1.Width, Picture1.Height
    
    End Sub
    Please note that for simplicity sake, I did not include any Error Handling.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    81

    Talking

    I'm happy

    Cheers guys. I'll come up with a harder one some time...


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