summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorToon Nolten <toonn@toonn.io>2018-10-01 14:39:53 +0200
committerGitHub <noreply@github.com>2018-10-01 14:39:53 +0200
commit036d2f312632b1a65876a7b56678a0828104b483 (patch)
treead1d9a5f5f9262c5ea9d195b876c282498cdee19
parent8e9451e6648c57d8016dad280132bf65a5d919cc (diff)
parent7473c285fc3525aa70b684f3136b58e0352fe146 (diff)
downloadranger-036d2f312632b1a65876a7b56678a0828104b483.tar.gz
Merge pull request #1319 from mark-dawn/kitty-format-fix
Fix for issue #1312 (wrong color format)
-rw-r--r--ranger/ext/img_display.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index f78e170b..cd9b18d6 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -588,14 +588,14 @@ class KittyImageDisplayer(ImageDisplayer):
             image = image.resize((int(scale * image.width), int(scale * image.height)),
                                  self.backend.LANCZOS)
 
+        if image.mode != 'RGB' and image.mode != 'RGBA':
+            image = image.convert('RGB')
         # start_x += ((box[0] - image.width) // 2) // self.pix_row
         # start_y += ((box[1] - image.height) // 2) // self.pix_col
         if self.stream:
             # encode the whole image as base64
             # TODO: implement z compression
             # to possibly increase resolution in sent image
-            if image.mode != 'RGB' and image.mode != 'RGBA':
-                image = image.convert('RGB')
             # t: transmissium medium, 'd' for embedded
             # f: size of a pixel fragment (8bytes per color)
             # s, v: size of the image to recompose the flattened data