Results 1 to 3 of 3

Thread: How do I resize a picture when I save it so it takes up less disk space??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Bryan, Texas
    Posts
    27

    Post

    Ok, I'm making another database application which involves needing to access an image from a database. I have it setup so the usere can select any image and place it into the viewing field, but I'd like to make it so that the picture would only be saved as something like 240*320 pixels. This would not take up as much space on the disk. How would I do this apart from an activex control...(I'm downloading one currently which should do this resizing operation, but it'll probably take up too much space and offer too many imaging options that I'll never use, since it's not a paint program I'm making.)


    ------------------
    Mitchell Hayenga
    [email protected]

  2. #2
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    I think you can't avoid using a third party control unless you want to write an image compressing tool.

    Roger

  3. #3
    Lively Member
    Join Date
    Jan 2000
    Location
    North Yorkshire
    Posts
    102

    Post

    Hi,
    This is possible as I've had to do similar (I've got a bitmap in memory and wanted to save it (see the http://www.vb-world.net/ubb/Forum1/HTML/015425.html thread). Bascially you have to do the following;

    Assuming you have your picture in a picture box you can do it one of two ways

    (a) - Rough and ready, StretchBlt your picture from it's current picture box into another picture box but scaled to be the size in pixels that you want. Then you can do a SavePicture thingy on the picture box
    (b) - Scarey API.
    Create a Memory DC (compatible with your picturebox)
    Stretchblt your image into it to the scale that you want
    Convert the MemoryDC into a DeviceIndependantBitmap
    Save the Memory location for this DIB as a file

    Either will work, but (a)'s far easier, but it depends on exactly how you want your application to work

    cheers

    Andy

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