Loading imgutils/upscale/cdc.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,4 +63,4 @@ def upscale_with_cdc(image: ImageTyping, model: str = 'HGSR-MHR-anime-aug_X4_320 ) output_ = np.clip(output_, a_min=0.0, a_max=1.0) ret_image = Image.fromarray((output_[0].transpose((1, 2, 0)) * 255).astype(np.int8), 'RGB') return [_rgba_postprocess(ret_image, alpha_mask, order=i) for i in range(6)] return _rgba_postprocess(ret_image, alpha_mask) imgutils/upscale/transparent.py +4 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ def _rgba_preprocess(image: ImageTyping): return pimage, alpha_mask def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None, order: int = 1): def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None): """ Postprocess the image after RGBA conversion. Loading @@ -61,8 +61,9 @@ def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None, order: in else: channels = np.array(pimage) alpha_mask = scipy.ndimage.zoom( alpha_mask, np.array(channels.shape[:2]) / np.array(alpha_mask.shape), order=1, mode='nearest', alpha_mask, np.array(channels.shape[:2]) / np.array(alpha_mask.shape), mode='nearest' ) alpha_channel = (alpha_mask * 255.0).astype(np.uint8)[..., np.newaxis] rgba_channels = np.concatenate([channels, alpha_channel], axis=-1) Loading Loading
imgutils/upscale/cdc.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,4 +63,4 @@ def upscale_with_cdc(image: ImageTyping, model: str = 'HGSR-MHR-anime-aug_X4_320 ) output_ = np.clip(output_, a_min=0.0, a_max=1.0) ret_image = Image.fromarray((output_[0].transpose((1, 2, 0)) * 255).astype(np.int8), 'RGB') return [_rgba_postprocess(ret_image, alpha_mask, order=i) for i in range(6)] return _rgba_postprocess(ret_image, alpha_mask)
imgutils/upscale/transparent.py +4 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ def _rgba_preprocess(image: ImageTyping): return pimage, alpha_mask def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None, order: int = 1): def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None): """ Postprocess the image after RGBA conversion. Loading @@ -61,8 +61,9 @@ def _rgba_postprocess(pimage, alpha_mask: Optional[np.ndarray] = None, order: in else: channels = np.array(pimage) alpha_mask = scipy.ndimage.zoom( alpha_mask, np.array(channels.shape[:2]) / np.array(alpha_mask.shape), order=1, mode='nearest', alpha_mask, np.array(channels.shape[:2]) / np.array(alpha_mask.shape), mode='nearest' ) alpha_channel = (alpha_mask * 255.0).astype(np.uint8)[..., np.newaxis] rgba_channels = np.concatenate([channels, alpha_channel], axis=-1) Loading