View Single Post
Old 25th May 2020, 22:00   #1  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
MeGUI Resizing Functions - AnyResizerMeGUI & CropResizeMeGUI

AnyResizerMeGUI & CropResizeMeGUI 2022-10-04.zip

I wanted to solve an issue with MeGUI's resizing... the inability to use the Script Creator for cropping and resizing using a non-Avisynth resizer, without having to manually edit the scripts it creates, which can be annoying, as every time a change is made in the AVS Script Cretaor GUI, it re-writes the script.

This post is dedicated to the AnyResizerMeGUI script and the functions it contains.
The next post will be dedicated to using the CropResizeMeGUI function as it requires images, so it'll also be a substitute for a help file.

The new version includes a zip file containing Avisynth profiles. It can be imported directly into MeGUI via the "File/Import Presets" menu, so the Avisynth templates don't need to be created manually. Should you not wish to keep them, they're easily deleted.

None of this will be likely to work with DGI Source configured to do the cropping and resizing in the AVS profile. I don't know how that's added to a script.

The AnyResizerMeGUI script contains the following functions. I won't go into too much detail as it comes with a help file. Instead I'll just offer some usage examples. The functions are intended to be used after creating appropriate AVS Profiles (templates) in the Script Creator.

AnyResizerMeGUI()
Returns MeGUI's resizing width and height as a string. The width and height are separated by a comma.
ie 640,480
AnyResizerTooMeGUI()
The same as for AnyResizerMeGUI, only the "a" and "b" arguments are included in the string when a Bicubic resizing option is selected.
ResizerMeGUI()
Returns the selected resizer in the AVS Script Creator as a string.
ie "Spline36Resize"
WidthMeGUI()
Returns MeGUI's resizing width as an integer.
HeightMeGUI()
Returns MeGUI's resizing height as an integer.
CropMod4WMeGUI()
Automatically crops the source to a Mod4 width. See the help file for usage details.

Here's how the above functions are used in an AVS Profile (template).
The first example specifies the Resize8 function for resizing. I use it regularly as it corrects the slight chroma shift that the Avisynth resizers can introduce. It also tells the Resize8 function which resizing kernel to use according to the resizing method specified in the Script Creator profile, or selected in it's GUI.

Code:
<input>
<deinterlace>
<crop>
<denoise>
Eval("Resize8("+AnyResizerMeGUI(Last,"<resize>")+",Kernel="+"""ResizerMeGUI("<resize>")"""+")")
The above would result in the following, assuming MeGUI is resizing to 1280x720 and Spline36Resize is the selected method in MeGUI's script creator.

Code:
<input>
<deinterlace>
<crop>
<denoise>
Resize8(1280,720,Kernel="Spline36Resize")
The next example gives MeGUI the ability to upscale with NNEDI3.

Code:
<input>
<deinterlace>
<crop>
<denoise>
nnedi3_rpow2(rfactor=2,cshift=ResizerMeGUI(Last,"<resize>"),fwidth=WidthMeGUI(Last,"<resize>"),fheight=HeightMeGUI(Last,"<resize>"))
The above would result in the following, assuming MeGUI is resizing to 1280x720 and Spline36Resize is the selected method in MeGUI's script creator.

Code:
<input>
<deinterlace>
<crop>
<denoise>
nnedi3_rpow2(rfactor=2,cshift="Spline36Resize",fwidth=1280,fheight=720)
With any luck the included functions should allow the creation of templates that allow MeGUI to use any resizer.

If you don't have Avisynth installed and/or you don't auto-load plugins and scripts, you'll need to include importing the AnyResizerMeGUI script in the template, along with the appropriate resizing plugin or script and it's dependencies.

Last edited by hello_hello; 3rd October 2022 at 15:47.
hello_hello is offline   Reply With Quote