Resize an Image and saving it to Disk

  • Thread starter Gustavo De la Espriella
  • Start date
G

Gustavo De la Espriella

Hi,
I'm having trouble resizing images while mantaining resolution.
I used the following code to save a jpeg file to disk, but with the
GetThumbImage it loses resolution.
----------------------------------------------
MyImage = System.Drawing.Image.FromFile(Request.PhysicalApplicationPath &
"images\TempExterno.jpg")
MyImage.GetThumbnailImage(600, (MyImage.Size.Height * (600 /
MyImage.Size.Width)), myCallback,
IntPtr.Zero).Save(Request.PhysicalApplicationPath & "images\" &
strIDProducto & ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
----------------------------------------------
How can I create a file from another picture file with a different size
(mantaining a decent quality)?

Thanks;

Gustavo Antonio De la Espriella
 
H

Herfried K. Wagner

Hello,

Gustavo De la Espriella said:
How can I create a file from another picture file with a
different size (mantaining a decent quality)?

\\\
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)
Me.PictureBox1.Image = bmp2
bmp2.Save("C:\foo.bmp")
///

Regards,
Herfried K. Wagner
 
N

NNM.RU

Use PNG files, they are in a way compressed BMPs. They give same quality at
a much smaller size.


).Save(Request.PhysicalApplicationPath & "images\" &
strIDProducto & ".png", System.Drawing.Imaging.ImageFormat.PNG)
 

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