Commits

Shlomi Fish  committed 6543eca

Extract common code.

  • Participants
  • Parent commits 8ed90e1

Comments (0)

Files changed (1)

File hhfg-background.py

         fn = ("%s-%s.png" % (filename_base,ext))
         pdb.file_png_save(cropped_image, cropped_image.active_drawable, fn, fn, False, 9, False, False, False, False, False)
 
-    save_crop (0, 0, image_width, margin_height+radius, "top")
-    save_crop (0, (image_height-(margin_height+radius)),
-            image_width, margin_height+radius, "bottom")
-    save_crop (0, image_height/2, image_width, 1, "middle")
+    def my_save_crop(name, y, h):
+        return save_crop(0, y, image_width, h, name)
+
+    tot_h = margin_height + radius
+    my_save_crop ("top", 0, tot_h)
+    my_save_crop ("bottom", (image_height-tot_h), tot_h)
+    my_save_crop ("middle", image_height/2, 1)
 
     gimp.Display(image)
     gimp.context_pop()