mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-30 23:58:11 +00:00
allow only one of width an height to be specified
This commit is contained in:
parent
7059852586
commit
04562dcaa1
@ -4,7 +4,7 @@
|
|||||||
Name: Video2X Upscaler
|
Name: Video2X Upscaler
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: December 10, 2018
|
Date Created: December 10, 2018
|
||||||
Last Modified: September 9, 2020
|
Last Modified: September 10, 2020
|
||||||
|
|
||||||
Description: This file contains the Upscaler class. Each
|
Description: This file contains the Upscaler class. Each
|
||||||
instance of the Upscaler class is an upscaler on an image or
|
instance of the Upscaler class is an upscaler on an image or
|
||||||
@ -588,7 +588,15 @@ class Upscaler:
|
|||||||
|
|
||||||
# if user specified output resolution
|
# if user specified output resolution
|
||||||
# calculate number of passes needed
|
# calculate number of passes needed
|
||||||
if self.scale_width is not None and self.scale_height is not None:
|
if self.scale_width is not None or self.scale_height is not None:
|
||||||
|
|
||||||
|
# scale keeping aspect ratio is only one of width/height is given
|
||||||
|
if self.scale_width is None:
|
||||||
|
self.scale_width = self.scale_height / height * width
|
||||||
|
|
||||||
|
elif self.scale_height is None:
|
||||||
|
self.scale_height = self.scale_width / width * height
|
||||||
|
|
||||||
self.scale_ratio = 2
|
self.scale_ratio = 2
|
||||||
|
|
||||||
# when scaled output resolution is smaller than target output resolution
|
# when scaled output resolution is smaller than target output resolution
|
||||||
|
@ -13,7 +13,7 @@ __ __ _ _ ___ __ __
|
|||||||
Name: Video2X Controller
|
Name: Video2X Controller
|
||||||
Creator: K4YT3X
|
Creator: K4YT3X
|
||||||
Date Created: Feb 24, 2018
|
Date Created: Feb 24, 2018
|
||||||
Last Modified: September 9, 2020
|
Last Modified: September 10, 2020
|
||||||
|
|
||||||
Editor: BrianPetkovsek
|
Editor: BrianPetkovsek
|
||||||
Last Modified: June 17, 2019
|
Last Modified: June 17, 2019
|
||||||
@ -190,10 +190,6 @@ if video2x_args.ratio is not None and (video2x_args.width is not None or video2x
|
|||||||
Avalon.error(_('Specify either scaling ratio or scaling resolution, not both'))
|
Avalon.error(_('Specify either scaling ratio or scaling resolution, not both'))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if bool(video2x_args.width) ^ bool(video2x_args.height):
|
|
||||||
Avalon.error(_('Only one of scaling width and scaling height is specified'))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# redirect output to both terminal and log file
|
# redirect output to both terminal and log file
|
||||||
if video2x_args.disable_logging is False:
|
if video2x_args.disable_logging is False:
|
||||||
LOGFILE = video2x_args.log
|
LOGFILE = video2x_args.log
|
||||||
|
Loading…
Reference in New Issue
Block a user