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 7990473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:01:15+00:00 2026-06-04T13:01:15+00:00

I am trying to write a scheme script for GIMP 2.8, which will resize

  • 0

I am trying to write a scheme script for GIMP 2.8, which will resize and rename/copy files. As part of this I would like to change the output file name based on a boolean set in the script.

My conditional however, is being ignored. Here is an excerpt of the script (based on one in this thread):

(define (script-fu-batch-resize globexp globext src) 
 (define (resize-img n f newx suffix srcdir removetailingunderscore) 
  (let* ((fname (car f))

     ;get path, short name + extension (remember to remove source dir to REPLACE with suffix!)
    (fullname (car (last (strbreakup fname "\\"))))
    (filepath (substring fname 0 (- (string-length fname) (string-length (string-append srcdir fullname)))))
    (name0 (car (strbreakup fullname ".")))
    (name1 (substring name0 0 (- (string-length name0) 1)) )

    (when 
    (> 1 0)
    (
        (name0 (name1) )
    )
    )

    (extension (cadr (strbreakup fullname ".")))

     (img   (car (gimp-file-load 1 fname fname)))) 
    (gimp-image-undo-disable img) 
    (let* 
      ( 
         (oldx (car (gimp-image-width  img))) 
         (oldy (car (gimp-image-height img))) 
         (newy (/ oldy (/ oldx newx))) 
       ) 
       (gimp-image-scale img newx newy)         ;changed for Gimp v2.6
     )              
    (gimp-file-save 1 img (car (gimp-image-get-active-drawable img)) (string-append filepath suffix "\\" name1 "." extension) fname) 
        (gimp-image-delete img) 
   ) 
   (if (= n 1) 1 (resize-img (- n 1) (cdr f) newx suffix srcdir removetailingunderscore)) 
  )
 (define sourcepattern (string-append globexp src globext))
 (define files (file-glob sourcepattern 0))                     ;changed for Gimp v2.6 
 (resize-img (car files) (car (cdr files)) 55 "micro" src 1) 

)

I have tried using when and if-else but no matter what no statement inside the conditional block is executed (i.e. if I had the same statement for true and false in the if, neither would be executed). My conditional is being completely ignored but I do not know why. GIMP does not report any syntax errors.

I would suspect I cannot have a conditional inside the define statement, except there is one that works right below it.

Can anyone see what is wrong? Why is my conditional being ignored?

  • 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-06-04T13:01:16+00:00Added an answer on June 4, 2026 at 1:01 pm

    There are several problems with the when expression:

    • It uses a couple of unnecessary parenthesis
    • The condition (> 1 0) is always true, therefore it’s useless
    • That’s not the way to change the value of a variable, use set!
    • Move the whole when expression outside the variable definition part of the let*, and make it the first statement in the body of the let*

    What you need to do is something like this:

    (define (script-fu-batch-resize globexp globext src) 
      (define (resize-img n f newx suffix srcdir removetailingunderscore) 
        (let* ((fname (car f))
               (fullname (car (last (strbreakup fname "\\"))))
               (filepath (substring fname 0 (- (string-length fname) (string-length (string-append srcdir fullname)))))
               (name0 (car (strbreakup fullname ".")))
               (name1 (substring name0 0 (- (string-length name0) 1)))
               (extension (cadr (strbreakup fullname ".")))           
               (img   (car (gimp-file-load 1 fname fname))))
          (when (> 1 0)
            (set! name0 name1))
          <rest of the body>)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to write a scheme program which will take a list of
I'm trying to write a xml schema that will validate this piece of xml:
I'm trying to write a composite component like this <!DOCTYPE html PUBLIC -//W3C//DTD XHTML
Trying to write a couple of functions that will encrypt or decrypt a file
Trying to write a chat, like on facebook, I wondered if two clients can
I'm trying to write a SQL Server database update script. I want to test
I'm trying to write a table trigger which queries another table that is outside
I am trying to write a data migration pl/sql script to transfer some of
I'm trying to write a toy python Scheme interpreter based on the meta-circular evaluator
I'm trying to write a schema that will validate the following XML: <category type=rifles>

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.