| 1 |
From: YOKOTA Hiroshi <[email protected]> |
| 2 |
Date: Wed, 13 May 2026 10:57:41 +0900 |
| 3 |
Subject: Use PIL to provide reproducible icon image |
| 4 |
|
| 5 |
Forwarded: not-needed |
| 6 |
|
| 7 |
PyQt (QImage class) dose not provide reproducible image data |
| 8 |
between different machines. |
| 9 |
Use PIL for reproducible build. |
| 10 |
--- |
| 11 |
src/calibre/linux.py | 6 +++--- |
| 12 |
1 file changed, 3 insertions(+), 3 deletions(-) |
| 13 |
|
| 14 |
diff --git a/src/calibre/linux.py b/src/calibre/linux.py |
| 15 |
index 9f4cb07..125233b 100644 |
| 16 |
--- a/src/calibre/linux.py |
| 17 |
+++ b/src/calibre/linux.py |
| 18 |
@@ -1422,10 +1422,10 @@ def write_appdata(key, entry, base, translators): |
| 19 |
|
| 20 |
|
| 21 |
def render_img(image, dest, width=128, height=128): |
| 22 |
- from qt.core import QImage, Qt |
| 23 |
+ from PIL import Image |
| 24 |
|
| 25 |
- img = QImage(I(image)).scaled(int(width), int(height), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation) |
| 26 |
- img.save(dest) |
| 27 |
+ img = Image.open(fp=I(image)).resize(size=(int(width), int(height))) |
| 28 |
+ img.save(fp=dest) |
| 29 |
|
| 30 |
|
| 31 |
def main(): |