This script modifies a layer to have a perspective and reflection consistent with that perspective.

This script is not finished. It has not been tested very much, and it is missing major features to come later on.
To install this script, copy it to your scripts folder, then restart Gimp. If you don't know where your scripts folder is, then go to Edit > Preferences > Folders > Scripts.
To run this script, select Filters > Decor > Perspective Reflection.
Feedback is appreciated.
| Attachment | Size |
|---|---|
| perspective-reflection-v0.10.scm | 2.5 KB |
Comments
I've added Hoffi's suggestions to your script
I went ahead and added Hoffi's suggestions to your script and made a few adjustments of my own (I lightened the gradient (255 255 255) and moved the middle position to 0.5). The fade was just too dark for my tastes. Anyone wanting to darken the fade, just comment out the 2nd line shown below:
; ...so we could move the middle pos to fade-out not soo fast
;(gimp-gradient-segment-set-middle-pos gradient 0 0.5)
@dln385: If you want, you can replace your file with this updated one, which I give Hoffi credit for his suggestions.
You can grab the updated file here: http://www.mahvin.com/scripts/perspective-reflection-v0.2.scm
No fade
No fading effect
No fading effect
fading effect proposal
Hi,
I have tried to add fading and it works on my GIMP 2.6.8 (Windows XP). Here is my proposal:
- to "undo" context changes (e.g. I set a gradient) insert
(gimp-context-push)below the undo-group-start and
(gimp-context-pop)above the undo-group-end
- in the let* block add a layer mask and a gradient:
(mask (car (gimp-layer-create-mask layer2 ADD-ALPHA-MASK)))(gradient (car (gimp-gradient-new "Gray to Black for fade-out")))
- (optional) rename the new layer and move it below orig layer on layer stack (instead of param "1"):
(gimp-image-add-layer img layer2 (+ (car (gimp-image-get-layer-position img layer1)) 1))(gimp-layer-set-name layer2 (string-append (car (gimp-layer-get-name layer1)) "-Reflection"))
- add a layer mask and initialise the gradient (I deceideed to create an own gradient because (a) linear fading looks not good for me and (b) we can't copy a predefined gradient because they are identified by name which is unfortunately language-dependent):
(gimp-layer-add-mask layer2 mask); Initialize the gradient
(gimp-gradient-segment-set-left-color gradient 0 '(160 160 160) 100)
(gimp-gradient-segment-set-right-color gradient 0 '(0 0 0) 100)
; this goes to black very fast...
(gimp-gradient-segment-range-set-blending-function gradient 0 -1 GRADIENT-SEGMENT-SPHERE-INCREASING)
; ...so we could move the middle pos to fade-out not soo fast
; (gimp-gradient-segment-set-middle-pos gradient 0 0.6)
; finally make it active
(gimp-context-set-gradient gradient)
Note: The start color '(160 160 160) could become script parameter to make it selectable by user
- now draw the gradient to the layer mask:
(gimp-layer-set-edit-mask layer2 TRUE)(gimp-edit-blend mask CUSTOM-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE FALSE 1 0 FALSE 0 old-height 0 (/ (* old-height 1) 3))
(gimp-layer-set-edit-mask layer2 FALSE)
Note: The layer is not transformed yet so we must fade from bottom to top. The last parameter (old-height/3) could also be made user-selectable.
- now we could apply the mask
(gimp-layer-remove-mask layer2 MASK-APPLY)or keep it separate
- then original transformation follows and finally we should delete our gradient:
(gimp-gradient-delete gradient)- optionally you can apply Mr. Gauss to soften the reflection ;)
I hope this is useful and thanks for the possibility to lern a bit scripting GIMP - it was my first try :)
Hoffi
Complete code (with fading effect)
Hi !
That's the code proposed by Hoffi :
http://www.webdesignerbelem.com/downloads/gimp/scripts/perspective-refle...
or
http://www.manualdainternet.com.br/downloads/gimp/scripts/perspective-re...
I appreciated a lot. Thanks everybody.
Following comments are details in portuguese language:
Olá. Este é um script-fu para o Gimp. Ele cria um efeito de reflexo (espelho) na camada selecionada. Basta copiar para a pasta "Program Files\GIMP-2.0\share\gimp\2.0\scripts" ou equivalente e executar novamente o Gimp. É criado um novo menu "Extras" com essa funcionalidade. O download pode ser feito nos seguintes endereços:
http://www.manualdainternet.com.br/downloads/gimp/scripts/perspective-re...
ou
http://www.webdesignerbelem.com/downloads/gimp/scripts/perspective-refle...
Abraços.
Powerpoint
perspective reflection
perspective reflection
I can't figure it out! more
What do you need help with?
installing the script
To install the script
What's it coded in?
Does not work in Gimp 2.6
Greetings,
I'm not able to get it to work in Gimp 2.6 UNIX (*BSD).
I place the script in the correct folder (scripts/), and I find it and apply it to an
Image. But only the perspective, and layer flip part(s) work NOT the
gradient fade. :(
Where did the example image shown on this page come from? It does not
appear that this plugin made the example shown above, as the part that
performs the gradient fade doesn't exist in the plugin script. :(
Thanks for trying.
--GW
The reason for the lack of
The reason for the lack of the fading is explained by the script author; check the other comments.