diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 87e86867..1afdf071 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -231,7 +231,10 @@ class ThumbSrv(object): try: im.thumbnail(res2, resample=Image.LANCZOS) if crop: - im = ImageOps.fit(im, self.res, method=Image.LANCZOS) + iw, ih = im.size + dw, dh = self.res + res = (min(iw, dw), min(ih, dh)) + im = ImageOps.fit(im, res, method=Image.LANCZOS) except: im.thumbnail(self.res)