From 5815a5e07db11ca27b12020aecef63d9acbb3796 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 May 2016 20:26:49 +0530 Subject: [PATCH] Implement clone_image() --- src/calibre/utils/img.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/utils/img.py b/src/calibre/utils/img.py index 0282328c85..1b0ba07b0d 100644 --- a/src/calibre/utils/img.py +++ b/src/calibre/utils/img.py @@ -160,6 +160,11 @@ def crop_image(img, x, y, width, height): height = min(height, img.height() - y) return img.copy(x, y, width, height) +def clone_image(img): + ''' Returns a shallow copy of the image. However, the underlying data buffer + will be automatically copied-on-write ''' + return QImage(img) + def normalize_format_name(fmt): fmt = fmt.lower() if fmt == 'jpg':