User944339287 posted
hi guys.. the following url is my reference site:
https://www.aspdotnet-suresh.com/2011/05/how-to-resize-size-image-without-losing.html
I having an issue while converting to vb using https://converter.telerik.com/
Error Message: Type of 'image' cannot be inferred from an expression containing 'image'
Private Sub GenerateThumbnails(ByVal scaleFactor As Double, ByVal sourcePath As Stream, ByVal targetPath As String)
Using image = Image.FromStream(sourcePath)
Dim newWidth = CInt((image.Width * scaleFactor))
Dim newHeight = CInt((image.Height * scaleFactor))
Dim thumbnailImg = New Bitmap(newWidth, newHeight)
Dim thumbGraph = Graphics.FromImage(thumbnailImg)
thumbGraph.CompositingQuality = CompositingQuality.HighQuality
thumbGraph.SmoothingMode = SmoothingMode.HighQuality
thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic
Dim imageRectangle = New Rectangle(0, 0, newWidth, newHeight)
thumbGraph.DrawImage(image, imageRectangle)
thumbnailImg.Save(targetPath, image.RawFormat)
End Using
End Sub

