Notifications
Clear all
[Closed] .net Image resizing
Feb 26, 2013 3:01 pm
I am looking for an efficient means to resize bitmaps in max using .net, whereby i can make use of the HighQualityBicubic interpolation.
Here is a snippet of VB code from msdn
Dim image As New Bitmap("GrapeBunch.bmp")
Dim width As Integer = image.Width
Dim height As Integer = image.Height
--Shrink the image using high-quality interpolation.
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
--Pass in the destination rectangle, and the upper-left corner, width,
--and height of the source rectangle as above.
e.Graphics.DrawImage( _
image, _
New Rectangle(290, 250, CInt(0.6 * width), CInt(0.6 * height)), _
0, _
0, _
width, _
height, _
GraphicsUnit.Pixel)
Unfortunately my knowledge of VB is somewhat limited, can any VB scripters suggest a way of implementing something similar directly in maxscript?
Any thoughts or suggestions much appreciated.
D.
2 Replies
Feb 26, 2013 3:01 pm
something like that:
fn dotnetImageResize image width height =
(
new = dotNetObject "System.Drawing.Bitmap" width height image.PixelFormat
g = (dotnetclass "System.Drawing.Graphics").FromImage new
g.SmoothingMode = g.SmoothingMode.HighQuality
g.CompositingQuality = g.CompositingQuality.HighQuality
g.InterpolationMode = g.InterpolationMode.HighQualityBicubic
g.PixelOffsetMode = g.PixelOffsetMode.highQuality
g.DrawImage image 0 0 width height
new
)