Perspective Reflection Script

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.

AttachmentSize
perspective-reflection-v0.10.scm2.5 KB
0
Average: 4.6 (9 votes)

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

Doesn't work for me on Mac, Gimp 2.6.6. Perspective works but no fade. Looking at the source for the script, I do not notice the fade or reflection in there at all. I looks like it - figures out how much it wants to change the perspective - creates the second layer - transforms the 1st layer for perspective based on calculated values - transforms the 2nd layer (reflection) in a similar way - resizes the canvas - ends the undo group Thats it. Did you remove the fade code? Is there a version of it with the fade still in there?

No fading effect

I can affirm what was said about Gimp 2.6 on Win XP: There's no fading effect on my machine either.

No fading effect

I tried to implement fading by applying a layer mask, but I ran into a bug in gimp that causes the mask to corrupt and for gimp to crash. This is only my second program, so I don't know enough to handle this kind of situation. I'll work on it, but I might not be able to get it to work. In the meantime, you can add your own fade effect to the reflection layer. Also, the code is open source if anyone wants to take a shot at it.

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

I use it for more effective ppt presentation

perspective reflection

work fine for me ;.) gimp 2.6 Thank's ... petit louis

perspective reflection

Using Gimp 2.6 in Windows XP. Perspective side works fine, but the reflection is just a full sized flipped mirror of the original. What is missing, it seems, is fading to transparent around 40% of the way down. Very nice work and I'm sure this problem will be fixed soon. :)

I can't figure it out! more

I can't figure it out! more detail please!

What do you need help with?

Do you need help installing the script, or do you need help using it?

installing the script

installing the script

To install the script

Follow the instructions given by these links: docs.gimp.org/... techzilo.com/... osp.wikidot.com/... video.google.com/... I can't give you specific instructions because the procedure changes depending on the version of gimp you have installed, your operating system, and any customizations you've made to either.

What's it coded in?

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.

Syndicate content