How to use the getnative.app.GetNative function in getnative

To help you get started, we’ve selected a few getnative examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Infiziert90 / getnative / getnative / app.py View on Github external
args.frame = src.num_frames // -args.frame
    elif args.frame > src.num_frames - 1:
        raise GetnativeException(f"Last frame is {src.num_frames - 1}, but you want {args.frame}")

    if args.ar == 0:
        args.ar = src.width / src.height

    if args.min_h >= src.height:
        raise GetnativeException(f"Input image {src.height} is smaller min_h {args.min_h}")
    elif args.min_h >= args.max_h:
        raise GetnativeException(f"min_h {args.min_h} > max_h {args.max_h}? Not processable")
    elif args.max_h > src.height:
        print(f"The image height is {src.height}, going higher is stupid! New max_h {src.height}")
        args.max_h = src.height

    getn = GetNative(src, scaler, args.ar, args.min_h, args.max_h, args.frame, args.mask_out, args.plot_scaling,
                     args.plot_format, args.show_plot, args.no_save, args.steps, output_dir)
    try:
        loop = asyncio.get_event_loop()
        best_value, plot, resolutions = loop.run_until_complete(getn.run())
    except ValueError as err:
        raise GetnativeException(f"Error in getnative: {err}")

    gc.collect()
    print(
        f"\n{scaler} AR: {args.ar:.2f} Steps: {args.steps}\n"
        f"{best_value}\n"
    )

    return resolutions, plot

getnative

Find the native resolution(s) of upscaled material (mostly anime)

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages