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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:43:11+00:00 2026-06-05T04:43:11+00:00

I am a little new to Script-Fu and need to do a resolution change

  • 0

I am a little new to Script-Fu and need to do a resolution change from 600DPI to 300DPI and then a canvas resize to 1000px W by 2000px H while leaving the actual image size intact. Otherwise my picture gets stretched.

I’m sure the script should go something along the lines of like this one I’ve found. But this one in particular complains about my image being indexed and it want’s an RGB image. Which I don’t want to do…

;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
; File = script-fu-grow-canvas.scm
; function name script-fu-grow-canvas
;
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
( define
  ( script-fu-grow-canvas
    theImage
    theDrawable
  )
  ;
  (gimp-image-undo-group-start theImage)

  ( let*
    (
      ; Define local variables
      ;    imageWidth, imageHeight, centerX, centerY
      ; Measure the height and width of the image.
      ; Calculate the center
      ( imageWidth ( car ( gimp-drawable-width theDrawable )))
      ( imageHeight ( car ( gimp-drawable-height theDrawable )))
      ( centerX ( / imageWidth 2 ))
      ( centerY ( / imageHeight 2 ))
      ( tenthWidth ( / imageWidth 8 ))
      ( tenthHeight ( / imageHeight 8 ))
      ( borderx tenthWidth )
      ( bordery tenthHeight )
      ( newWidth 0 )
      ( newHeight 0 )
      ( dummyLayer 0 )
      ( layername "DummyLayer" )
      ;
    ) ; End of Variable Declaration
    ; if Aspect ratio widget is unchecked make X and Y
    ;   length the greater of the two.
    ( set! newWidth ( + imageWidth ( * borderx 2 )))
    ( set! newHeight ( + imageHeight ( * bordery 2 )))
    ;
    ( set! dummyLayer (car ( gimp-layer-new
                theImage
                imageWidth
                imageHeight
                0
                layername
                10
                0 ))
    )
    ( gimp-image-add-layer theImage dummyLayer 1 )
    ( gimp-layer-resize dummyLayer
                newWidth
                newHeight
                borderx
                bordery )
    ( script-fu-para-tat-layer
          theImage
          dummyLayer
          layername )

    ( gimp-image-resize-to-layers theImage )
    ;
    ( gimp-drawable-set-visible dummyLayer FALSE )
    ( gimp-image-set-active-layer theImage theDrawable )

  ) ; END let*
  (gimp-image-undo-group-end theImage)

) ; END define

( script-fu-register "script-fu-grow-canvas"  ; Function Name
  "02 Expand Canvas"    ; Menu Label
  "Expand the image canvas based on image
   size"        ; Function Description
  "Stephen Kiel"         ; Author
  "2011, Stephen Kiel"   ; Copyright
  "December 2011"        ; Creation Date
  "*"                    ; Valid Image Type
  SF-IMAGE "theImage"  0
  SF-DRAWABLE "theDrawable" 0
) ; End script-fu-register
( script-fu-menu-register
     "script-fu-grow-canvas" "<Image>/Flowzilla/Flow - Standard")
  • 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-05T04:43:12+00:00Added an answer on June 5, 2026 at 4:43 am

    You are using gimp-layer-new to create a new RGB type layer – this type of layer cannot be added to an indexed image.

    Lots of other script-fu calls might be restricted for indexed images – and there are ways to work around them – but it is not the case here

    The value with the layer type is the “0” you put just before the “layername” parameter. According to the documentation (visible using the “Procdure Browser” in GIMP’s help menu),
    there is an enumaration for layer types, and you should be passing INDEXEDA-IMAGE to it, for indexed images (0 is for RGB-IMAGE).

    It is important to use the named constants as they are shown in the documentation, not the numbers they represent, since these numbers are not guaranteed to remain the same across versions, and due to the fact that using the names adds context and readability to your code.

    Likewise, you should not use “10” for the layer mode, and rather the apropriate constant name that suits you (LIGHTEN-ONLY-MODE in GIMP 2.6)

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

Sidebar

Related Questions

I'm totally new to GreaseMonkey, but I'm trying to make a little script. //
I'm a little new at PHP, so my script writing is still progressing. I
I have the following script which I need to modify a little. Here is
I'm brand new to ruby. I've written a little script, and at the top
I am very new to ffmpeg and beanstalk and I need a little help.
I'm loading a Groovy script/class from a remote server, creating a new instance, and
A little new to EF, so please bear with me if the answer to
I'm a little new to javascript. I have a bunch of checkboxes for an
I'm a little new with SQL so bear with me. I have two tables,
hello i am little new to all this but i want to know that:

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.