[gimp] Bug 643174 - GIMP fails to execute 'Palette to Gradient' function



commit bd74617756eb5416ffd9d15568a988a8d7086060
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 17 19:21:07 2011 +0100

    Bug 643174 - GIMP fails to execute 'Palette to Gradient' function
    
    Don't call gimp_gradient_segment_range_split_uniform() if num_segments
    is 1 (which happens on a palette with two colors).

 plug-ins/pygimp/plug-ins/palette-to-gradient.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/pygimp/plug-ins/palette-to-gradient.py b/plug-ins/pygimp/plug-ins/palette-to-gradient.py
index 61048ac..5f6d6d5 100644
--- a/plug-ins/pygimp/plug-ins/palette-to-gradient.py
+++ b/plug-ins/pygimp/plug-ins/palette-to-gradient.py
@@ -19,7 +19,10 @@ gettext.install("gimp20-python", gimp.locale_directory, unicode=True)
 
 def make_gradient(palette, num_segments, num_colors):
     gradient = pdb.gimp_gradient_new(palette)
-    pdb.gimp_gradient_segment_range_split_uniform(gradient, 0, -1, num_segments)
+
+    if (num_segments > 1):
+        pdb.gimp_gradient_segment_range_split_uniform(gradient, 0, -1,
+                                                      num_segments)
 
     for color_number in range(0,num_segments):
         if (color_number == num_colors-1):color_number_next = 0



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