Re: Error on the bash command line

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

 




On 04/06/2011 12:09 PM, houghi wrote:
> ...elision by patrick...
> I am still looking for a solution. :-(
> I looked at http://www.gimp.org/tutorials/Basic_Batch/ and that worked. So
> it must be something to do with either the parameters or the way I place
> them on the command line.
>
> I looked at /usr/share/gimp/2.0/scripts/fuzzyborder.scm and there I saw:
> (define (script-fu-fuzzy-border inImage
>                                 inLayer
>                                 inColor
>                                 inSize
>                                 inBlur
>                                 inGranu
>                                 inShadow
>                                 inShadWeight
>                                 inCopy
>                                 inFlatten
>         )
>
>
> The command and output is:
> houghi@penne : gimp --verbose --batch-interpreter plug-in-script-fu-eval -i -b "(script-fu-fuzzy-border \"file.jpg\" '(0 0 0) 50 0 16 FALSE 1 FALSE)" -b '(gimp-quit 0)'
This command:

gimp -i -c -d -b '(batch_fuzzy_border "./alyssa01.jpg" "pink" 40 TRUE 10
TRUE 50) ' -b '(gimp-quit 0)'

just worked for me with the attached versions of batchfuzzy.scm and
fuzzyborder.scm using GNU Image Manipulation Program version 2.7.2.  I
made some changes here and there to fix errors in the scripts and to get
rid of calling deprecated methods.  This may make it not work on earlier
versions.  YMMV.  I'm sorry that no one bothered to look at the problem
and led you on wild goose chases.  This group is usually more helpful
than that.

Patrick

;
; fuzzy-border
;
; Do a cool fade to a given colour at the border of an image (optional shadow)
; Will make image RGB if it isn't already.
;
; Chris Gutteridge (cjg@xxxxxxxxxxxxxxx)
; At ECS Dept, University of Southampton, England.

; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program.  If not, see <http://www.gnu.org/licenses/>.

; Define the function:

(define (script-fu-fuzzy-border inImage
                                inLayer
                                inColor
                                inSize
                                inBlur
                                inGranu
                                inShadow
                                inShadWeight
                                inCopy
                                inFlatten
        )

  (let (
       (theWidth (car (gimp-image-width inImage)))
       (theHeight (car (gimp-image-height inImage)))
       (theImage 0)
       (theLayer 0)
       )

    (gimp-context-push)

    (gimp-selection-all inImage)
    (set! theImage (if (= inCopy TRUE)
                     (car (gimp-image-duplicate inImage))
                     inImage
                   )
    )
    (if (> (car (gimp-drawable-type inLayer)) 1)
        (gimp-image-convert-rgb theImage)
    )

    (set! theLayer (car (gimp-layer-new theImage
                                        theWidth
                                        theHeight
                                        RGBA-IMAGE
                                        "layer 1"
                                        100
                                        NORMAL-MODE)))

    (gimp-image-insert-layer theImage theLayer 0 0)


    (gimp-edit-clear theLayer)
    (chris-color-edge theImage theLayer inColor inSize)

    (gimp-layer-scale theLayer
                      (/ theWidth inGranu)
                      (/ theHeight inGranu)
                      TRUE)

    (plug-in-spread RUN-NONINTERACTIVE
                    theImage
                    theLayer
                    (/ inSize inGranu)
                    (/ inSize inGranu))
    (chris-color-edge theImage theLayer inColor 1)
    (gimp-layer-scale theLayer theWidth theHeight TRUE)

    (gimp-image-select-item theImage 2 theLayer)
    (gimp-selection-invert theImage)
    (gimp-edit-clear theLayer)
    (gimp-selection-invert theImage)
    (gimp-edit-clear theLayer)
    (gimp-context-set-background inColor)
    (gimp-edit-fill theLayer BACKGROUND-FILL)
    (gimp-selection-none theImage)
    (chris-color-edge theImage theLayer inColor 1)

    (if (= inBlur TRUE)
        (plug-in-gauss-rle RUN-NONINTERACTIVE
			   theImage theLayer inSize TRUE TRUE)
    )
    (if (= inShadow TRUE)
        (begin
          (gimp-selection-none theImage)
          (gimp-image-insert-layer theImage 
                                (car (gimp-layer-copy theLayer FALSE)) 0 -1)
          (gimp-layer-scale theLayer
                            (- theWidth inSize) (- theHeight inSize) TRUE)
          (gimp-desaturate theLayer)
          (gimp-brightness-contrast theLayer 127 127)
          (gimp-invert theLayer)
          (gimp-layer-resize theLayer
                             theWidth
                             theHeight
                             (/ inSize 2)
                             (/ inSize 2))
          (plug-in-gauss-rle RUN-NONINTERACTIVE
                             theImage
                             theLayer
                             (/ inSize 2)
                             TRUE
                             TRUE)
          (gimp-layer-set-opacity theLayer inShadWeight)
        )
    )
    (if (= inFlatten TRUE)
        (gimp-image-flatten theImage)
    )
    (if (= inCopy TRUE)
      (begin
        (gimp-image-clean-all theImage)
        (gimp-display-new theImage)
      )
    )
    (gimp-displays-flush)

    (gimp-context-pop)
  )
)

(define (chris-color-edge inImage inLayer inColor inSize)
  (gimp-selection-all inImage)
  (gimp-selection-shrink inImage inSize)
  (gimp-selection-invert inImage)
  (gimp-context-set-background inColor)
  (gimp-edit-fill inLayer BACKGROUND-FILL)
  (gimp-selection-none inImage)
)

(script-fu-register "script-fu-fuzzy-border"
  _"_Fuzzy Border..."
  _"Add a jagged, fuzzy border to an image"
  "Chris Gutteridge"
  "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  "3rd April 1998"
  "RGB* GRAY*"
  SF-IMAGE      "The image"               0
  SF-DRAWABLE   "The layer"               0
  SF-COLOR      _"Color"                  "white"
  SF-ADJUSTMENT _"Border size"            '(16 1 300 1 10 0 1)
  SF-TOGGLE     _"Blur border"            TRUE
  SF-ADJUSTMENT _"Granularity (1 is Low)" '(4 1 16 0.25 5 2 0)
  SF-TOGGLE     _"Add shadow"             FALSE
  SF-ADJUSTMENT _"Shadow weight (%)"      '(100 0 100 1 10 0 0)
  SF-TOGGLE     _"Work on copy"           TRUE
  SF-TOGGLE     _"Flatten image"          TRUE
)

(script-fu-menu-register "script-fu-fuzzy-border"
                         "<Image>/Filters/Decor")
; batchfuzzy.scm
;
; Apply script-fu-fuzzy-border as a batch process.
;
; Batchfuzzy is copyright 2008 by Floyd L. Davidson, floyd@xxxxxxxxxxx
; Script-fu-fuzzy-border is defined in fuzzyborder.scm, which is
; copyright by Chris Gutteridge, cjg@xxxxxxxxxxxxxxxx
;
; This file should be placed in directory ~/.gimp-2.4/scripts with
; a filename that ends with ".scm".
;
; GIMP is then called from the command line to process all files
; that fit the specified pattern.  Command line syntax is:
;
;   gimp -i -c -d -b '(batch_fuzzy_border "pattern" "color" \
;                     border_size toggle_blur granularity   \
;                     toggle_shadow percent_shadow)' -b '(gimp-quit 0)'
;
;    "pattern"     : a regular expression pattern specifying files
;                     (example:  "*.jpg")
;
;    "color"       : color of the border
;                     (example:  "pink")
;
;    border_size   : border size in pixels
;                     (example:  20)
;
;    toggle_blur   : blur toggle, 1/0 or TRUE/FALSE
;                     (example:  TRUE)
;
;    granularity   : granularity, 1 or more where 1 is low
;                     (example:  4)
;
;    toggle_shadow : toggle shadow, 1/0 or TRUE/FALSE
;                     (example:  TRUE)
;
;    percent_shadow: percent of border that is shadowed
;                     (example:  75)
;
;  A typical example of a command line to invoke this program is:
;
;   gimp -i -c -d -b '(batch_fuzzy_border "*.jpg" "pink" 40 \
;        TRUE 10 TRUE 50 )' -b '(gimp-quit 0)'
;
;
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.

(define (batch_fuzzy_border  pattern
                             color
                             size
                             blurt
                             gran
                             shadowt
                             shadowp)

  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
      (let* ((filename (car filelist))
	     (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
	     (drawable (car (gimp-image-get-active-layer image)))
	    )
	(script-fu-fuzzy-border image drawable color size blurt gran shadowt shadowp FALSE TRUE)
	(set! drawable (car (gimp-image-get-active-layer image)))
	(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
	(gimp-image-delete image)
      )
      (set! filelist (cdr filelist))
    )
  )
)
;
; End of batchfuzzy.scm file.
_______________________________________________
Gimp-user mailing list
Gimp-user@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

[Index of Archives]     [Gimp Announce]     [Gimp GUI]     [Gimp Images]     [GIMP Development]     [Video For Linux]     [Photos]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Scanners]     [Gimp's Home]     [Gimp Docs]     [Gimp on Windows]     [Steve's Art]     [Webcams]     [Share Your Images]     [Script Fu]     [GIMP Software]     [GIMP Books]

  Follow Gimp on Twitter