Resizing Images

J

Jarod_24

How do i resize a image to 150x150?

Does .Net have support for resizing images, and does it work with any types
of images? (*.jpg, *.gif and *.bmp support needed most, *.eps maybe)


*Jarod_24 gives Herfried a big hug in advance*
 
H

Herfried K. Wagner [MVP]

* "Jarod_24 said:
How do i resize a image to 150x150?

Does .Net have support for resizing images, and does it work with any types
of images? (*.jpg, *.gif and *.bmp support needed most, *.eps maybe)

\\\
Dim bmp As New Bitmap( _
"C:\Lagoon1024x768.bmp" _
)
Dim bmp2 As New Bitmap( _
bmp.Width * 0.1, _
bmp.Height * 0.1, _
Imaging.PixelFormat.Format24bppRgb _
)
Dim g As Graphics = Graphics.FromImage(bmp2)

' Select/change interpolation mode here.
g.InterpolationMode = _
Drawing.Drawing2D.InterpolationMode.HighQualityBicubic

' Draw image using specified interpolation mode.
g.DrawImage(bmp, 0, 0, bmp2.Width, bmp2.Height)
g.Dispose()

Me.PictureBox1.Image = bmp2
///

You can call 'bmp2''s 'Save' method to write the bitmap to a file.
There you can specify the destination image format too.
 
C

Cor

Hi Herfried,

I have given it to someone in the newsgroup. (Your name is in it of course)
dotnet.general
An extra question was if it supports transparant gifs.

I have told to try and than when not to respond in this newsgroup referering
your and my name.

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor said:
I have given it to someone in the newsgroup. (Your name is in it of course)
dotnet.general

No problem.
An extra question was if it supports transparant gifs.

I have told to try and than when not to respond in this newsgroup referering
your and my name.

I never tested that, but I hope the OP will share his experiences with
us.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top