[Part I. GIMP基礎功]

[Part II. 一種效果的誕生]
[Part III. Script-Fu的秘密]



27.3 一步一步做,讓雲霧消失

以下,操作GIMP圖形介面,一步一步做,來製作迷彩圖案。藉由這過程,來瞭解程式碼的意思。

Step 1. 執行[影像] / 檔案 / 新增【註1】,新增一張透明底色256x256影像。


Step 2. 再新增兩個透明圖層。
Step 3. 三個圖層更名為Camo Thick Layer、Camo Thick Layer、Background。



前面三步驟,相當於下列的程式碼。
36: (gimp-image-add-layer theImage baseLayer 0)
37:
38: (set! thickLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thick Layer" 100 NORMAL-MODE)))
39: (gimp-image-add-layer theImage thickLayer 0)
40:
41: (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE)))
42: (gimp-image-add-layer theImage thinLayer 0)


Step 4. 將Background圖層全選,使用顏料桶填色工具,塗滿RGB植為(33,100,58)的綠色。



前面的步驟,對應到下列的程式碼。
44: (gimp-selection-all theImage)
45: (gimp-context-set-background inColor1)
46: (gimp-drawable-fill baseLayer BACKGROUND-FILL)


Step 5. 對Camo Thick Layer與Camo Thick Layer圖層,分別執行[影像] / 濾鏡 / 描繪 / 雲狀 / Solid Noise【註2】,勾選「可鋪排」選項,不勾選「湍流」選項,產生灰階霧狀效果。勾選可鋪排選項,產生的圖案是無接縫的圖案。




前面的步驟,對應到下列的程式碼。
48: (plug-in-solid-noise RUN-NONINTERACTIVE
49: theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain)
50: (plug-in-solid-noise RUN-NONINTERACTIVE
51: theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain)

Step 6. 對Camo Thin Layer圖層執行[影像] / 色彩 / 界限值【註3】,調整界限值範圍,將範圍設為145到255。利用「界限值」指令,可產生黑白二色斑塊的影像,調整不同的界限值範圍,可產生不同的黑白斑塊分布情況。




前面的步驟,對應到下列的程式碼。
52: (gimp-threshold thickLayer 127 255)
53: (gimp-threshold thinLayer 145 255)


選單及項目名稱的英文:
【註1】[Image] / File / New
【註2】[Image] / Filters / Render / Clouds / Solid Noise,勾選Tilable,不勾選Turbulent。在2.6.7版,Clouds的譯詞是「雲朵」,之前的版本是「雲狀」,我個人偏好「雲狀」一詞。
【註3】[Image] / Colors / Threshold