Help me develope this script (grab viewport with quality control)

Help me develope this script (grab viewport with quality control)

Waseem_Dabbas
Advocate Advocate
851 Views
8 Replies
Message 1 of 9

Help me develope this script (grab viewport with quality control)

Waseem_Dabbas
Advocate
Advocate

Hi, I have this script in the attachment files below

This script can make a grab viewport for many cameras at once while max can only make for 1.

 

I want to ask if someone can help me improve it by adding only 1 option to control the antialiasing or the image quality like the one that came with 3ds max viewport grab.

Hope you understand my question.

Waiting for your answers.

 

Thank you

 

0 Likes
852 Views
8 Replies
Replies (8)
Message 2 of 9

denisT.MaxDoctor
Advisor
Advisor

Actually, this script has an author ... who better than him to make an addition to his script? Have you tried contacting him?

I will not, for example, extend an existing script and its user interface. But I can suggest you a function to filter the rendered image (smooth, scale, ...). You can try adding it to the code yourself or with someone else's help.

0 Likes
Message 3 of 9

Waseem_Dabbas
Advocate
Advocate

That's right, but I couldn't communicate with the scriptwriter.

I was wondering if the quality control can be one line added to the script or something that someone can help me add it.

0 Likes
Message 4 of 9

denisT.MaxDoctor
Advisor
Advisor

It's no problem to add or remove a couple of lines from the code. The problem is that this is someone else's code. And for me, as for most developers, it makes more sense to write your own code than to improve someone else's.

 

Here is an example of how to resize an image using .NET's built-in methods:

 

 

fn dotnetScaleImage filename: width: height: scale:0.5 outfile: =
(
	-- for example:
			-- filename = @"c:\temp\c.bmp"
			-- outfile = @"c:\temp\c.png" 
	
	image = (dotnetclass "System.Drawing.Image").FromFile filename
	
	if width == unsupplied do width = image.Width * scale 
	if height == unsupplied do height = image.Height * scale
	
	dest = dotnetobject "System.Drawing.Bitmap" width height --(dotnetclass "System.Drawing.Imaging.PixelFormat").Format32bppArgb
	graphics = (dotnetclass "System.Drawing.Graphics").FromImage dest

	graphics.CompositingMode 	= graphics.CompositingMode.SourceCopy
	graphics.CompositingQuality = graphics.CompositingQuality.HighQuality
	graphics.InterpolationMode 	= graphics.InterpolationMode.HighQualityBicubic
	graphics.SmoothingMode 		= graphics.SmoothingMode.HighQuality
	graphics.PixelOffsetMode 	= graphics.PixelOffsetMode.HighQuality

	--wrapMode = dotnetobject "System.Drawing.Imaging.ImageAttributes"
	--wrapMode.SetWrapMode (dotnetclass "System.Drawing.Drawing2D.WrapMode").TileFlipXY
	destRect = dotnetobject "System.Drawing.Rectangle" 0 0 width height 
	graphics.DrawImage image destRect 0 0 image.Width image.Height (dotnetclass "System.Drawing.GraphicsUnit").Pixel --wrapMode
	
	dest.Save outfile --(dotnetclass "System.Drawing.Imaging.ImageFormat").Png
	
	doesfileexist outfile  
)

/************************************** EXAMPLE *******************************

dotnetScaleImage filename:@"c:\temp\c.bmp" scale:0.25 outfile:@"c:\temp\c.png"

******************************************************************************/

 

 

 

 
0 Likes
Message 5 of 9

denisT.MaxDoctor
Advisor
Advisor

@Waseem_Dabbas wrote:

I was wondering if the quality control can be one line added to the script or something that someone can help me add it.


the tool simply captures (takes a snapshot of) the specified viewport. The quality of the captured image is determined by the size and settings of the viewport. The best we can do is take a larger size and resize it to what we need with good interpolation techniques.

0 Likes
Message 6 of 9

Waseem_Dabbas
Advocate
Advocate

Thank you for your effort, but actually, this script doesn't work for some reason I don't know why.
All that I need is not to control the size of the image (width and height) but to control the quality which is antialiasing that removes the flickering showing in the edges of the curved or parallel narrow lines, which can be found in the grab viewport tool under the name "Image quality".

Hope I could explain my point.

I can attach a short video to explain more if you want.
Thank you again for trying to help. 🙏🏻

0 Likes
Message 7 of 9

denisT.MaxDoctor
Advisor
Advisor

can you show a picture with the user interface and the tool you are talking about?

 

0 Likes
Message 8 of 9

Waseem_Dabbas
Advocate
Advocate
0 Likes
Message 9 of 9

denisT.MaxDoctor
Advisor
Advisor

let's see what we can do...

 
0 Likes