SQLの窓 イラストAC フリー素材

2012年12月17日

Analogize(torres-analogize.scm) の解説というか、日本語化『GIMP 用スクリプト』



デフォルト値の表示等、レイヤーを分解したままをデフォルトとする等少し変更していますが、機能そのものは変更していません。メニューバーと、右クリックのメニューのトップに Effects で実行できるようにも変更しています。



要するに、元絵に対してコントラストと彩度を設定して、レイヤーとして白いグラデーションと黒いグラデーションを使って陰影を付けています。標準的な画像にメリハリが出てとてもいい感じになる事が多いです。
※ レイヤーは『オーバレイ』モードで重ねられています。



以下は、スクリプトを適用したものです。



※ UTF-8N で保存して下さい。
;
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; Analogize script  for GIMP 2.4
; Copyright (C) 2005 Ismael Valladolid Torres <ivalladt@punkass.com>
;
; Tags: photo, old
;
; Author statement:
;; A script-fu for the GIMP that makes any picture look as if it had
;; been taken using an old analog camera. Exaggerates contrast and
;; saturation and creates a bright and a dark overlay randomly
;; placed. Think of it as kind of a Lomo Kompakt or Kodak instantmatic
;; faking effect. However it still can't make anything to emulate the
;; peculiar chromatism usually achieved using the real thing.
;;
;; Check http://analogize.berlios.de/ for more information.
;
;
; --------------------------------------------------------------------
; Distributed by Gimp FX Foundry project
; --------------------------------------------------------------------
;   - Changelog -
;
; --------------------------------------------------------------------
;
;    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 (script-fu-analogize img
                 drawable
                 contrast
                 saturation
                 bright-opacity
                 shadow-opacity
                 duplicate-shadow
                 flatten
                 copy)
 (let* (
        (image 0)
        (layer 0)
        (image-width 0)
        (image-height 0)
        (half-image-width 0)
        (half-image-height 0)
        (center-x 0)
        (center-y 0)
        (bright-layer 0)
        (shadow-layer 0)
        (shadow-layer2 0)
        (width-factor 0)
        (height-factor 0)
       )

  (set! image (if (= copy TRUE)
          (car (gimp-image-duplicate img))
          img))

  (gimp-image-undo-group-start image)

  (set! layer (car (gimp-image-flatten image)))

  (set! image-width (car (gimp-image-width image)))
  (set! image-height (car (gimp-image-height image)))

  (set! half-image-width (/ image-width 2))
  (set! half-image-height (/ image-height 2))

  (set! width-factor (/ (- 85 (rand 170)) 100))
  (set! height-factor (/ (- 85 (rand 170)) 100))

  (set! center-x (+ half-image-width (* half-image-width width-factor)))
  (set! center-y (+ half-image-height (* half-image-height height-factor)))

  (gimp-brightness-contrast layer 0 contrast)
  (gimp-hue-saturation layer 0 0 0 saturation)

  (set! bright-layer (car (gimp-layer-new image
                      image-width
                      image-height
                      1 "Brillo" bright-opacity 5)))

  (gimp-image-add-layer image bright-layer 0)
  (gimp-edit-clear bright-layer)
  (gimp-context-set-foreground '(255 255 255))

  (gimp-edit-blend bright-layer 2 0 2 100 0 0 FALSE FALSE 0 0 TRUE
           center-x center-y
           (+ half-image-width center-x) 0)

  (set! shadow-layer (car (gimp-layer-new image
                      image-width
                      image-height
                      1 "Sombra" shadow-opacity 5)))

  (gimp-image-add-layer image shadow-layer 0)
  (gimp-edit-clear shadow-layer)
  (gimp-context-set-foreground '(0 0 0))

  (if (= (rand 2) 0)
      (begin
    (gimp-edit-blend shadow-layer 2 0 0 100 0 0 FALSE FALSE 0 0 TRUE
             0 0
             center-x center-y)

    (gimp-edit-blend shadow-layer 2 0 0 100 0 0 FALSE FALSE 0 0 TRUE
             image-width image-height
             center-x center-y))
      (begin
    (gimp-edit-blend shadow-layer 2 0 0 100 0 0 FALSE FALSE 0 0 TRUE
             image-width 0
             center-x center-y)

    (gimp-edit-blend shadow-layer 2 0 0 100 0 0 FALSE FALSE 0 0 TRUE
             0 image-height
             center-x center-y)))

  (cond ((= duplicate-shadow TRUE)
     (set! shadow-layer2 (car (gimp-layer-copy shadow-layer 0)))
     (gimp-image-add-layer image shadow-layer2 0)))

  (cond ((= flatten TRUE)
     (gimp-image-flatten image)))

  (cond ((= copy TRUE)
     (gimp-display-new image)))

  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
  )
)

(script-fu-register "script-fu-analogize"
            "Analogize..."
            "A simple analog camera faking effect"
            "Ismael Valladolid Torres <ivalladt@punkass.com>"
            "Ismael Valladolid Torres"
            "2005"
            "RGB*"
            SF-IMAGE "The image" 0
            SF-DRAWABLE "The layer" 0
            SF-ADJUSTMENT "コントラスト(20)" '(20 0 60 1 5 0 0)
            SF-ADJUSTMENT "彩度(20)" '(20 0 60 1 5 0 0)
            SF-ADJUSTMENT "レイヤーの不透明度(80)" '(80 0 100 1 10 0 0)
            SF-ADJUSTMENT "影のレイヤーの不透明度(100)" '(100 0 100 1 10 0 0)
            SF-TOGGLE "影のレイヤーを2枚にして濃くする" TRUE
            SF-TOGGLE "処理後の画像を統合する" FALSE
            SF-TOGGLE "Work on copy" TRUE)

(script-fu-menu-register "script-fu-analogize"
             "<Image>/Effects")

analogize.berlios.de は現在存在しません。
現在オリジナルは、http://www.gimphelp.org/script28.shtml よりダウンロードできます



タグ:GIMP
posted by at 2012-12-17 20:40 | GIMP スクリプト | このブログの読者になる | 更新情報をチェックする