Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6084095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:28:54+00:00 2026-05-23T11:28:54+00:00

I have this script as an .scm in Gimp: ;MIT license. (define (script-fu-export-layers img

  • 0

I have this script as an .scm in Gimp:

;MIT license.

(define (script-fu-export-layers img drw path outnameformat)
; credit to Vijay Mathew on Stack Overflow for the expand keywords function
  (let ((expand-keywords (lambda(format tokens)
    (let loop ((slist (string->list string))
               (in-replace-mode #f)
               (result ""))
      (if (not (null? slist))
          (let ((c (car slist)))
            (cond (in-replace-mode
                   (let ((token (car (cdr (assoc c tokens)))))
                     (loop (cdr slist) #f (string-append result token))))
                  ((char=? c #\~)
                   (loop (cdr slist) #t result))
                  (else
                   (loop (cdr slist) #f (
                      string-append result (make-string 1 c))))))
          result)))))
  (for-each (lambda (layer)
    (let* (
        (name (expand-keywords outnameformat '(
          (#\i (car(gimp-image-get-name img)))
          (#\l (car(gimp-drawable-get-name layer))))))
        (outpath (string-append path "/" name)))
      (gimp-file-save RUN-NONINTERACTIVE img layer outpath name)
  )) (vector->list(cadr (gimp-image-get-layers img)))))
)

(script-fu-register
  "script-fu-export-layers"
  "L_ayers"
  "Export all layers as individual files."
  "Stuart P. Bentley <stuart@testtrack4.com>"
  "Copyright 2011 Stuart P. Bentley"
  "June 28, 2011"
  "*"
  SF-IMAGE       "The Image"         0
  SF-DRAWABLE    "The Layer"         0
  SF-DIRNAME     "Output directory"  ""
  SF-STRING      "Filename Format (~i = image name, ~l = layer name)"
                                                          "~i-~l.png"
)
(script-fu-menu-register "script-fu-export-layers" "<Image>/File/E_xport")

With the comment at the top of the file, the script doesn’t load at all. When the comment is removed, GIMP throws an error when refreshing scripts that “Error while loading C:\Users\Stuart.gimp-2.6\scripts\export-layers.scm: Error: unmatched parentheses: 1”. I don’t know what that’s about, since it parses fine when I run it on Codepad (it breaks at the script-fu-register point).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:28:54+00:00Added an answer on May 23, 2026 at 11:28 am

    This behavior is consistent with what would happen if the line endings were missing (the comments commenting out all subsequent text). Check to make sure your editor isn’t doing something ridiculous like saving your file with CR line endings on Windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this script <select> <option value=1>one<img src=star.gif height=15 width=15></img> </option> </select> but it
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I have this script which basically toggles a bgColor class on and off so
i have this script $content = string if(!isset($_GET['page'])){ $page = 1; } else{ $page
I have this script to generate an XML file for an RSS feed. Works
I have this script and when i try to run it, it just says
I have this script at the moment, which changes an image when a thumbnail
I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
I have this script <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = dirname(__FILE__)
I have this script that collects data from users and I want to check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.