By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,688 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,688 IT Pros & Developers. It's quick & easy.

Image Size

P: n/a
Hi All,

I have created an application that allows users to upload images to
their listed events. When a user views their event their uploaded
image is also displayed.

However does anyone know if it is possible to resize the image at run
time??? As at the moment the images uploaded just get squashed and
distorted in the image control. Or alternatively is there a way to
obtain the height and width values from an image file when it is
uploaded??

Thanks in advance,

Simon

Oct 22 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Oct 22, 10:54 am, si_owen <s.o...@sstaffs.gov.ukwrote:
Hi All,

I have created an application that allows users to upload images to
their listed events. When a user views their event their uploaded
image is also displayed.

However does anyone know if it is possible to resize the image at run
time??? As at the moment the images uploaded just get squashed and
distorted in the image control. Or alternatively is there a way to
obtain the height and width values from an image file when it is
uploaded??

Thanks in advance,

Simon
Are you using a PictureBox control to display the image? If so, what
is the value for the SizeMode property? If you set it to Zoom, the
image displayed in the picture box will be adjusted to fill out the
picturebox while maintaining the image's original aspect ratio.

Oct 22 '07 #2

P: n/a
Generally you may create a new bitmap then read the image file content into
the bitmap and then check the Height and the Width members
"si_owen" <s.****@sstaffs.gov.ukwrote in message
news:11**********************@e34g2000pro.googlegr oups.com...
Hi All,

I have created an application that allows users to upload images to
their listed events. When a user views their event their uploaded
image is also displayed.

However does anyone know if it is possible to resize the image at run
time??? As at the moment the images uploaded just get squashed and
distorted in the image control. Or alternatively is there a way to
obtain the height and width values from an image file when it is
uploaded??

Thanks in advance,

Simon

Oct 22 '07 #3

P: n/a
Guys,

I am using Visual Studio 2003, and my project is a web application. So
I cant use picturebox as this is limited to win forms.

Any other sugggestions?

Cheers,

Simon

Oct 23 '07 #4

P: n/a
On Oct 23, 3:53 am, si_owen <s.o...@sstaffs.gov.ukwrote:
Guys,

I am using Visual Studio 2003, and my project is a web application. So
I cant use picturebox as this is limited to win forms.

Any other sugggestions?

Cheers,

Simon
You can still use the System.Drawing members to read the width and
height values of the uploaded image. Then to resize it, you just need
to draw the image onto a new image object that is the proper size. As
with most GDI+ topics, Bob Powell has a sample on his site that does a
high quality resize. This is actually the link for generating a
thumbnail, but it seems to do a terrific job. You can browse his other
topics for a few more samples.

http://www.bobpowell.net/highqualitythumb.htm

Thanks,

Seth Rowe
Oct 23 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.