Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim img = Image.FromFile([The Image Path], True)
- Dim maxHeight As Single = 284.0F
- Dim newWidth As Single = img.Width * (maxHeight / img.Height)
- Dim imageCopy = New Bitmap(CInt(newWidth), CInt(maxHeight), PixelFormat.Format32bppArgb)
- imageCopy.SetResolution(img.HorizontalResolution, img.VerticalResolution)
- Using g = Graphics.FromImage(imageCopy),
- attributes = New ImageAttributes()
- attributes.SetGamma(1.12F, ColorAdjustType.Bitmap)
- g.SmoothingMode = SmoothingMode.None
- g.PixelOffsetMode = PixelOffsetMode.Half
- g.InterpolationMode = InterpolationMode.HighQualityBilinear
- g.DrawImage(img, New Rectangle(0, 0, imageCopy.Width, imageCopy.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, attributes)
- End Using
- img.Dispose()
- Return imageCopy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement