GIMP Script-fu

Artifact [c864fbb52f]
Login

Artifact [c864fbb52f]

Artifact c864fbb52ff527667621854dd2bb21dd5986a10d:


; 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.

; pre-2.8 COMPATIBILITY
  (when (not (defined? 'gimp-item-is-layer))
    (define gimp-item-is-layer gimp-drawable-is-layer) )

(define (script-fu-sg-fvful image drawable)
  (when (and (= (car (gimp-item-is-layer drawable)) TRUE)
             (= (car (gimp-image-width image)) 192)
             (= (car (gimp-image-height image)) 192)
             (= (car (gimp-drawable-width drawable)) 192)
             (= (car (gimp-drawable-height drawable)) 192) )
    (gimp-image-undo-group-start image)
    (gimp-layer-scale-full drawable 144 144 TRUE INTERPOLATION-CUBIC) 
    (gimp-layer-set-offsets drawable 24 24)
    (gimp-image-undo-group-end image)
    (gimp-displays-flush) ))
        
(script-fu-register "script-fu-sg-fvful"
  "Fvful"
  "Scale and center layer in image"
  "Saul Goode"
  "Saul Goode"
  "October 2014"
  "*"
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Layer" 0
  )

(script-fu-menu-register "script-fu-sg-fvful"
 "<Image>/Filters/Misc"
 )