PDA

Click to See Complete Forum and Search --> : Resizing an Image


jcottrell
Jan 21st, 2004, 10:30 PM
I'd like to load an image (bmp or jpg) of unspecified size, resize it, and save it to a memory stream for display. I thought I could load it into a picture box and resize it that way but:

a) there has to be a cleaner more direct way to do this (i.e. shouldn't I be able to do this w/o loading it into a pictureBox?)
b) it looks like pictureBox holds an orginal copy of the image and gives you back that (via pictureBox.Image.Save), so this technique doesn't really seem to work anyway.

Ideas?

CornedBee
Jan 22nd, 2004, 05:19 AM
Load it into an Image. Create another Image with your desired target size. Stretch Blit the source image to the target image. Save the target Image.

sagey
Jan 22nd, 2004, 06:21 AM
.getthumbnail method is useful

jcottrell
Jan 22nd, 2004, 08:29 AM
Thanks guys, those are some good ideas...

PT Exorcist
Jan 27th, 2004, 07:13 AM
.getthumbnail does an awful job as it will blur the whole image

sagey
Jan 28th, 2004, 03:49 AM
i've used getthumbnail and it hasn't blurred the images, any more than reducing the size in photoshop etc.

PT Exorcist
Jan 28th, 2004, 11:26 AM
Maybe you had small images and didn't notice..but I assure you if you try with 1024x800 pictures it will blur them up :blush:

Redth
Jan 28th, 2004, 10:23 PM
http://www.vbforums.com/showthread.php?threadid=239738&highlight=resize


I ran into this problem a long time ago... but there is a good way to resize and even compress into jpg images properly... check out that link... and good luck :)