[gimp] Bug 783336: exported openraster (.ora) missing...



commit cd4a0a185c06935ae4377e2d607f1840e1825285
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Thu Dec 14 14:53:04 2017 +0100

    Bug 783336: exported openraster (.ora) missing...
    
    ...mergedimage.png
    
    fix also the thumbnail creation, that:
    must be 8 bit; should not be upscaled; should not have frame
    or decoration, that I interpreted as when there are transparent
    areas they should not be blended with a background color,
    so instead of image_flatten use  image_merge_visible_layers
    (also for the merged_image)

 plug-ins/pygimp/plug-ins/file-openraster.py |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/plug-ins/pygimp/plug-ins/file-openraster.py b/plug-ins/pygimp/plug-ins/file-openraster.py
index fa02a89..55b3a94 100755
--- a/plug-ins/pygimp/plug-ins/file-openraster.py
+++ b/plug-ins/pygimp/plug-ins/file-openraster.py
@@ -204,16 +204,22 @@ def save_ora(img, drawable, filename, raw_filename):
         else:
             add_layer(parent, x, y, opac, lay, path_name, lay.visible)
 
+    # save mergedimage
+    thumb = pdb['gimp-image-duplicate'](img)
+    thumb_layer = thumb.merge_visible_layers (CLIP_TO_IMAGE)
+    store_layer (thumb, thumb_layer, 'mergedimage.png')
+
     # save thumbnail
     w, h = img.width, img.height
-    # should be at most 256x256, without changing aspect ratio
-    if w > h:
-        w, h = 256, max(h*256/w, 1)
-    else:
-        w, h = max(w*256/h, 1), 256
-    thumb = pdb['gimp-image-duplicate'](img)
-    thumb_layer = thumb.flatten()
-    thumb_layer.scale(w, h)
+    if max (w, h) > 256:
+        # should be at most 256x256, without changing aspect ratio
+        if w > h:
+            w, h = 256, max(h*256/w, 1)
+        else:
+            w, h = max(w*256/h, 1), 256
+        thumb_layer.scale(w, h)
+    if thumb.precision != PRECISION_U8_GAMMA:
+        pdb.gimp_image_convert_precision (thumb, PRECISION_U8_GAMMA)
     store_layer(thumb, thumb_layer, 'Thumbnails/thumbnail.png')
     gimp.delete(thumb)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]