- 由於 rand 函數用法的差異,為求簡潔,Python 之中,直接引用 Scheme rand 函數所產生的數值。
(plug-in-solid-noise RUN-NONINTERACTIVE theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain)
(plug-in-solid-noise RUN-NONINTERACTIVE theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain)
Python code
rand_num1 = -17265
rand_num2 = 22498
pdb.plug_in_solid_noise(theImage, thickLayer, 1, 0, rand_num1, 1, inGrain, inGrain)
pdb.plug_in_solid_noise(theImage, thinLayer, 1, 0, rand_num2, 1, inGrain, inGrain)
Scheme code
(set! theBlur (- 16 inGrain))
Python code
theBlur = (16 - inGrain)
Scheme code 要注意括號對齊
(if (= inSmooth TRUE) (script-fu-tile-blur theImage thickLayer theBlur TRUE TRUE FALSE) )
Python code 要注意縮排
if (inSmooth): pdb.script_fu_tile_blur(theImage, thickLayer, theBlur, TRUE, TRUE, FALSE)
Scheme code
(gimp-by-color-select thinLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
Python code 拆成兩行
color_black = (0, 0, 0) pdb.gimp_by_color_select(thinLayer, color_black, 127, CHANNEL_OP_REPLACE, TRUE, FALSE, 0, FALSE)