Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Work without deprecated SciPy methods (Py3.9+) #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import os
import sys
import bz2
import PIL
import glob
import math
import time
import pickle
import random
import imageio
import argparse
import itertools
import threading
Expand Down Expand Up @@ -568,7 +570,7 @@ def process(self, original):
for i in range(3):
output[:,:,i] = self.match_histograms(output[:,:,i], original[:,:,i])

return scipy.misc.toimage(output, cmin=0, cmax=255)
return PIL.Image.fromarray((output).astype('uint8'), mode='RGB')


if __name__ == "__main__":
Expand All @@ -580,7 +582,7 @@ def process(self, original):
enhancer = NeuralEnhancer(loader=False)
for filename in args.files:
print(filename, end=' ')
img = scipy.ndimage.imread(filename, mode='RGB')
img = imageio.imread(filename, as_gray=False, pilmode="RGB")
out = enhancer.process(img)
out.save(os.path.splitext(filename)[0]+'_ne%ix.png' % args.zoom)
print(flush=True)
Expand Down