| Welcome, Guest |
You have to register before you can post on our site.
|
| Latest Threads |
gimp 3 and 8bf files
Forum: Extending the GIMP
Last Post: denzjos
5 hours ago
» Replies: 0
» Views: 50
|
Preferences/Folders shows...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: programmer_ceds
9 hours ago
» Replies: 5
» Views: 3,008
|
Problems with AppImages.
Forum: Installation and usage
Last Post: teapot
Yesterday, 07:45 PM
» Replies: 2
» Views: 331
|
Why am'I fighting with GI...
Forum: Linux and other Unixen
Last Post: NetWeeZurd
Yesterday, 01:44 AM
» Replies: 2
» Views: 193
|
Can tooltip display time ...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: NetWeeZurd
Yesterday, 01:40 AM
» Replies: 4
» Views: 1,313
|
Problem posting an update...
Forum: Gimp-Forum.net
Last Post: Scallact
12-21-2025, 10:19 PM
» Replies: 19
» Views: 986
|
Paint bucket acts "weird"
Forum: General questions
Last Post: PieterJW
12-21-2025, 06:59 PM
» Replies: 7
» Views: 428
|
Install gimp user manual ...
Forum: Linux and other Unixen
Last Post: rich2005
12-21-2025, 09:03 AM
» Replies: 1
» Views: 212
|
Very, very nice startup t...
Forum: General questions
Last Post: mrkid
12-18-2025, 04:37 PM
» Replies: 0
» Views: 193
|
Why does HTML/css scale i...
Forum: General questions
Last Post: Tas_mania
12-17-2025, 07:20 PM
» Replies: 1
» Views: 268
|
|
|
| Skript for mirroring left and right side of portrait photo |
|
Posted by: Juniata - 08-07-2017, 03:35 PM - Forum: Extending the GIMP
- Replies (6)
|
 |
Hi everybody!
I am a total beginner to Script Fu, and am having a hard time finding good documentation. If anybody has some good general advice, it is very much welcome.
But here is my specific problem:
I would like to write a script which lets me automatically create two images out of one portrait picture: One from the left half of the face and its mirror image, one from the right side respectively. It is to show that a face is never completely symmetric.
In order to get familiar with it all, I have written a very humble script, which should create two copies of the image and flip one of them horizontally.
But already I encounter a problem: It seems to safe the pictures and layers and does not renew them if I apply the script to a new image. Only if I restart GIMP, it renews them. Could somebody please tell me, how I delete the buffer or tell it to overwrite the image/drawable?
And if someone could already tell me the names of the procedures to only copy and flip a selected part of an image and to insert it in a defined place of the new drawable, so I can already try a bit. At least I hope that procedures like this exist...
Thank you so much!
Cheers!
Kat
Here is my current script:
(define (script-fu-two-faces img drw)
(let* (
(drawable-width (car (gimp-drawable-width drw)))
(halfdrawable-width (* drawable-width 0.5))
(drawable-height (car (gimp-drawable-height drw)))
(leftimage (car (gimp-image-new drawable-width drawable-height RGB)))
(leftlayer (car (gimp-layer-new leftimage drawable-width drawable-height 0 "tfl" 100 0)))
(rightimage (car (gimp-image-new drawable-width drawable-height RGB)))
(rightlayer (car (gimp-layer-new rightimage drawable-width drawable-height 0 "tfr" 100 0)))
)
(gimp-image-insert-layer leftimage leftlayer 0 0)
(gimp-drawable-fill leftlayer WHITE-FILL)
(gimp-display-new leftimage)
(gimp-image-insert-layer rightimage rightlayer 0 0)
(gimp-drawable-fill rightlayer WHITE-FILL)
(gimp-display-new rightimage)
(gimp-edit-named-copy drw "tobepastedleft")
(gimp-edit-named-paste leftlayer "tobepastedleft" TRUE)
(gimp-displays-flush)
(gimp-item-transform-flip drw halfdrawable-width 0 halfdrawable-width drawable-height)
(gimp-edit-named-copy drw "tobepastedright")
(gimp-edit-named-paste rightlayer "tobepastedright" TRUE)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-two-faces"
"Two faces..."
"Creates an image from left side of the face"
"K.Imai"
"K.Imai"
"2017"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable to apply" 0
)
(script-fu-menu-register "script-fu-two-faces" "<Image>")
|
|
|
|