| This tutorial describes the creation little smiling face by the meaning of a scheme script fu. | |
![]() |
I have choose this example because it's implement simple selection func, filling and one plug ins, whose are imho the simplest and first thing to learn in script fu. I accorded to you that otherwise this script is completly useless =) This tutorial is not indend to be linear but want to explain a given script this script take an arg : 'radius' , declared as a SF-VALUE at end of script-fu registration NB : car is in scheme the first part of a list, and cdr the rest. same way cadr is the first part of the rest... |
![]() |
first a perfect round ellipse selection
here we use img, which is the current active image.
We have created it by
this declaration will create img. here is it locked in a "let" in view to be reuse. (I want to open the script step by step...here one part, other come after)
at end of script we'll make this image visible
|
![]() |
now we want to fill this selection with yellow
in intention to do that we'll loose the foreground color, so we'll save it in
the upper let
and restitute at end of script
|
![]() |
now filling
in intention to fill we need a "drawable" layer. this layer is created in the
upper let by :
add to img by :
cleared by :
|
![]() |
so now the smile and the eyes :
we 'll define some settings in the upper let
and now create a other selection who REPLACE the older
now we want to have a area to stroke in black for the smile, we create a
border of size 2
and with SUB the upper part of this stroked circle selection
and ADD 2 circles for the eyes
now we can fill with black the selection :
|
![]() |
now we 'll jump over the selection step of the reflet creation, you just have to now that we'll select a ellipse and now SUB an smaller ellipse to get a "croissant"
we can now fill this "croissant" with white, at intensity 50
and apply a gaussian blur on a img + layer with (here) power 15 15. on :
now we'll duplicate layer called "reflet" and rotate it to create a second reflet exaclty opposite to this one
we'll put this one on the upper let under the name of 'reflet2'
add him to image
and rotate him by 90°
finished ! |
![]() |
rest to register the script in the data base, with his name, place, and args :
|
|
NB : if you want to register a script applyed to an existant image proceed as follow
the necessary arg can be followed by optionnal args and 'll be treated in the same order by the script.
|
|
here is the script.
Points you should remember about script fu:
close all the parents (if they are not in enought number then there is some error at gimp-launch time, but if they are misplaced error appear at run time).
verify that all the var you use in a func are registred somewhere when you use them (error at runtime)