100分,把这段代码翻译成c#的
This function creates the Thumbnail image and returns the
image created in Byte() format
Private Function createThumnail()Function createThumnail(ByVal ImageStream As Stream,
ByVal tWidth As Double, ByVal tHeight As Double) As Byte()
Dim g As System.Drawing.Image =System.Drawing.Image.FromStream(ImageStream)
Dim thumbSize As New Size()
thumbSize =NewthumbSize(g.Width, g.Height, tWidth, tHeight)
Dim imgOutput As New Bitmap(g, thumbSize.Width, thumbSize.Height)
Dim imgStream As New MemoryStream()
Dim thisFormat = g.RawFormat
imgOutput.Save(imgStream, thisFormat)
Dim imgbin(imgStream.Length) As Byte
imgStream.Position = 0
Dim n As Int32 = imgStream.Read(imgbin, 0, imgbin.Length)
g.Dispose()
imgOutput.Dispose()
Return imgbin
End Function
Function NewthumbSize()Function NewthumbSize(ByVal currentwidth As Double, ByVal
currentheight As Double, ByVal newWidth As Double, ByVal newHeight As Double)
' Calculate the Size of the New image
Dim tempMultiplier As Double
If currentheight > currentwidth Then ' portrait
tempMultiplier = newHeight / currentheight
Else
tempMultiplier = newWidth / currentwidth
End If
Dim NewSize As New Size(CInt(currentwidth * tempMultiplier),
CInt(currentheight * tempMultiplier))
Return NewSize
End Function