From 2064f53c343b221bbf565ac63236c5be57c33397 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 4 May 2020 09:22:44 +0200 Subject: [PATCH] Fix thumbnail scaling --- lib/src/utils/matrix_file.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/utils/matrix_file.dart b/lib/src/utils/matrix_file.dart index 93c8722..82298f5 100644 --- a/lib/src/utils/matrix_file.dart +++ b/lib/src/utils/matrix_file.dart @@ -27,7 +27,13 @@ class MatrixFile { } catch (_) { return false; } - final resizedImage = copyResize(image, width: width, height: height); + var resizedImage = image; + if (image.width > width) { + resizedImage = copyResize(image, width: width); + } + if (image.height > height) { + resizedImage = copyResize(image, height: height); + } bytes = encodeJpg(resizedImage, quality: quality); return true; }