From 993af0fb5b5ec8fe3303d73cbbbcee2938b3051f Mon Sep 17 00:00:00 2001 From: shooorf Date: Wed, 26 Jun 2019 20:47:09 +0300 Subject: [PATCH] Check if image does not require resizing --- src/image.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/image.c b/src/image.c index 2f085801..995fa849 100644 --- a/src/image.c +++ b/src/image.c @@ -1275,6 +1275,8 @@ float bilinear_interpolate(image im, float x, float y, int c) image resize_image(image im, int w, int h) { + if (im.w == w && im.h == h) return copy_image(im); + image resized = make_image(w, h, im.c); image part = make_image(w, im.h, im.c); int r, c, k;