It is currently Mon Mar 18, 2024 9:20 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 112 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: GC Shadow V1.2 (with Gradient Shadows & Glow)
PostPosted: Mon May 27, 2013 12:34 am  (#1) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
GC Shadow V1.2 (07-2013) - (c) Copyright 2013 GPLv3

Created by GnuTux

Special thanks to Graechan and SaulGoode for their contributions.

===========================
Improved Drop Shadow Script
===========================
Added Glow, Inner Shadow, Inner Glow and Feathering
Specify separate x & y blue radius
Added the ability to specify shadow name (or pass from another script)
Label shadow layers and using selected (or passed) layer name + shadow type
Added the ability to keep drop shadow on top at all times
V1.1 Now includes gradient shadow & glow support
Fully compatible wih GIMP 2.6.x or GIMP 2.8.x (with layer group support)

Image

Any suggestions for improvements/enhancements to this script, would be appreciated.

Located in Filters/Light and Shadow/GC Shadow..

Script Updated to V1.1 Official Release

Change Log
RC V0.1 - Initial Release Candidate
RC V0.2 - Fix Gaussian limits, Merge visible layers, Clear script's selections on exit
RC V0.3 - Resize shadow layer to compensate for shadow offset, blur & feather, Allow resize toggle, Correct shadow X & Y minimum limits
RC V0.4 - Fix Merge Visible Layers Bug that was introduced in RC v0.03
RC v0.5 - Improve layer positioning logic & correct artifact bug when resizing layers, Add option to merge selected layer with shadow layer
RC V0.6 - Added support for GIMP 2.8 layer groups, Name layers with selected shadow options, If shadow name is blank (default), use selected layer name, dump merge visible layers.
RC V0.7 - If shadow name is blank (default) then use selected layer name
Add toggle to keep shadow layer above selected layer
Simplify shadow merge logic
Always add alpha channel
Dump merge visible layers option
Rework image sizing with logic from original GIMP Drop Shadow Script
Ensure compatibility with GIMP 2.6.x & GIMP 2.8.x
=====================
V1.0 - Official Release
Correct small bug with resizing when glow is selected
When resizing the image, execute layer to image size on selected layer
V1.1 - Added Support for Gradient Shadow & Glow
V1.2 - Corrected bug to properly handle linked layers

Attachment:
File comment: Reuploaded by Wallace, GC Shadow V1.2 (07-2013) - (c) Copyright 2013 GPLv3
Created by GnuTux
Special thanks to Graechan and SaulGoode for their contributions.

gc-shadow.scm [20.62 KiB]
Downloaded 28 times


Image
Image
Image
Image

Gradient Shadows

Drop Shadow
Image

Inner Shadow
Image

Outer Glow
Image

Inner Glow
Image

Inner & Outer Glow
Image

Extrusion
Image

Image

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 1:13 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Tested your script. Few notes.
Script leaves alpha selection active.
Feathering works on selection, so i don't see any point in doing that if the script gaussian blurs shadow afterwards.
Maybe replace it by adding noise.
Blurring by zero value (e.g. i need a sharp shadow) returns error on invalid gaus-blur argument.
Merge layers as an option?


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 1:21 am  (#3) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
GnuTux may I suggest that if no selection was there to begin with then no selection should be there when finished

(let* (
(shadow-layer -1) ; Shadow layer
(saved-selection -1) ; Save Selection Variable
(sel (car (gimp-selection-is-empty img)))
)

then at the end

(if (= sel TRUE) (gimp-selection-none img))

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 1:23 am  (#4) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
K1TesseraEna wrote:
Script leaves alpha selection active.

Could that be useful or is it more of a problem? I was thinking if one is performing multiple manual selections, it should keep those. Otherwise, if the results were unsatisfactory, the user would have to select again.

K1TesseraEna wrote:
Feathering works on selection, so i don't see any point in doing that if the script gaussian blurs shadow afterwards.
Maybe replace it by adding noise.

That's an interesting idea. :bigthup

K1TesseraEna wrote:
Blurring by zero value (e.g. i need a sharp shadow) returns error on invalid gaus-blur argument.
Merge layers as an option?

Ah, yes. That's a bug. Thanks for pointing that out. Merge layers sounds good!

Thanks!

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 1:29 am  (#5) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Graechan wrote:
GnuTux may I suggest that if no selection was there to begin with then no selection should be there when finished

That is a good point, Graechan. I probably shouldn't leave a selection the script generates. That might have been K1TesseraEna's point, as well. I guess I should keep any selections coming in, but when no selections are there to begin with, don't add any. :bigthup

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 2:00 am  (#6) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
GnuTux The script results are great

Image

Image

Image

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 2:55 am  (#7) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
:tyspin Graechan, Esper and K1TesseraEna for testing this out and for your suggestions.

Your results are better than mine, Graechan. :hehe

I've fixed the Gaussian bug, ensured the selections are handled properly and added a merge visible layers option. Updated the first post with the new code.

I still need to decide the best method of resizing the shadow layer to compensate for shadow and blur offsets. As of now, it's "resize canvas", then "layer to image size". I'll go with that if there are no better suggestions.

Inner glow (black)
Image

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 6:25 am  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
You should increase the size of your shadow layer before blurring (by twice the blur radius) so that the blur does not get "chopped off" and have a hard edge as shown in the following image.

Attachment:
wilber-shadow.png
wilber-shadow.png [ 39.41 KiB | Viewed 7412 times ]


As to how resizing should be handled, the default Drop Shadow script seems to handle this properly and as long as you are willing to license your script under GPLv3, you are free to copy whatever you need from it.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 10:44 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
I second what saulgoode mentioned.
Shadows get cut off if the layer size is too small like in this case i used dynamic textbox (vs Fixed).

ImageImage


It can be fixed if script executes Layer_to_Image_Size command from PDB first.
As of now I have to make sure I've done it manually.

I like the script and I'm gonna keep it.
One request, thou. Script creates dropped shadow anywhere between 0 and 90 degrees only.
Of course i can move shadow layer around (if i hadn't merged it) but the possibility to
offset shadow in *all directions* would be great.
For that the script should recognize negative values for offset by x/y axes.
Or implement angle offset like Esper suggested.

Thank you!


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 11:03 am  (#10) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 12959
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
One thing I'd like to mention is that shadows are not entirely black in color all the time. This is one reason I have a tendency to create my own shadow using a gradient and not just solid black.

Is there a way to incorporate the use of gradients in the script?

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 11:27 am  (#11) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
saulgoode wrote:
You should increase the size of your shadow layer before blurring (by twice the blur radius) so that the blur does not get "chopped off"

Well, yeah. Avoiding getting "chopped off" is the entire point of resizing, right? :mrgreen:

saulgoode wrote:
As to how resizing should be handled, the default Drop Shadow script seems to handle this properly

Another example of self-documenting code, I see. :hehe

After a cursory glance, I see that the default drop shadow procedure uses gimp-image-resize to increase the canvas size, which was my initial thought, as well.

I'll go ahead and increase the canvas size by (blur x 2) + the shadow offsets. That's easy enough.

Thanks for link!

K1TesseraEna wrote:
the script should recognize negative values for offset by x/y axes.

Absolutely, it should. That was just an oversight on my part. Thanks for bringing it to my attention.

Wallace wrote:
One thing I'd like to mention is that shadows are not entirely black in color all the time. This is one reason I have a tendency to create my own shadow using a gradient and not just solid black.

Is there a way to incorporate the use of gradients in the script?

Sure. Currently, I'm filling with the selected color but I can add "fill with active gradient", as an alternative. There are problems with selecting gradients using Script-Fu in GIMP 2.8.4 so for now, I should probably go with "fill with active gradient". When they fix the bug, I can add a gradient select option, if needed.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 11:56 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
GnuTux wrote:
Wallace wrote:
One thing I'd like to mention is that shadows are not entirely black in color all the time. This is one reason I have a tendency to create my own shadow using a gradient and not just solid black.

Is there a way to incorporate the use of gradients in the script?

Sure. Currently, I'm filling with the selected color but I can add "fill with active gradient", as an alternative. There are problems with selecting gradients using Script-Fu in GIMP 2.8.4 so for now, I should probably go with "fill with active gradient". When they fix the bug, I can add a gradient select option, if needed.



Implementing gradient will result in ridiculous shadows. Doesn't blurring a shadow already create sort of black-to-grey gradient around edges?
Other drop shadow scripts does not offer that option either. Besides, what gradient is to be implemented - linear, radial, shaped? What will be the starting point for gradient drawing? IMO, it's way too complicated.


Top
 Post subject: Re: Custom Shadow Procedure
PostPosted: Mon May 27, 2013 12:32 pm  (#13) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 12959
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
Wallace wrote:
One thing I'd like to mention is that shadows are not entirely black in color all the time. This is one reason I have a tendency to create my own shadow using a gradient and not just solid black.

Is there a way to incorporate the use of gradients in the script?

GnuTux wrote:
Sure. Currently, I'm filling with the selected color but I can add "fill with active gradient", as an alternative. There are problems with selecting gradients using Script-Fu in GIMP 2.8.4 so for now, I should probably go with "fill with active gradient". When they fix the bug, I can add a gradient select option, if needed.


Sounds good to me. :bigthup

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Mon May 27, 2013 10:17 pm  (#14) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
I've updated the script to re-size the shadow layer (optional) and corrected the X & Y minimum values for shadow offsets.

I've edited the first post and placed the new version of the script on GIMP scripts for downloading.

@Wallace - I'll add the ability to create a shadow from a Gradient on a new release, for those who need that feature.

I'm thinking the best way to automate the applying of gradient (for this or any other script) is to add a drop-down for gradient shape, a slider running from 0-359 degrees for direction and an image boundary offset to use as the starting/ending points for the gradient fill.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Mon May 27, 2013 10:38 pm  (#15) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
GnuTux you could add 'Gradient' and 'Active Gradient' to your shadow fill choices

(active-gradient (car (gimp-context-get-gradient)))

(active-fg (car (gimp-context-get-foreground)))

(active-bg (car (gimp-context-get-background)))


For your gradient shape just use this in your menu

SF-ENUM "Gradient Shape" '("GradientType" "gradient-linear")

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Mon May 27, 2013 10:42 pm  (#16) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Will do, Graechan. :bigthup

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Mon May 27, 2013 11:07 pm  (#17) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Oh, I really like this script.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Mon May 27, 2013 11:10 pm  (#18) 
Offline
GimpChat Member

Joined: Apr 27, 2012
Posts: 11
Hai
Can we do shadow like shown in the below image
thank you

Image


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Tue May 28, 2013 12:24 am  (#19) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
GnuTux there are 2 more things to consider

So that your new shadow layer is equivalent to the image size

(if (= merge-visible-layers TRUE) ; Check for merge layers flag

(begin

(set! shadow layer (car (gimp-image-merge-visible-layers img 0))) ; Merge Visible Layers (expand as necessary)

)
) ; endif
(if (= merge-visible-layers FALSE) (gimp-layer-resize-to-image-size shadow-layer))

Also your shadow-layer should be on top, this is achieved by activating your saved selection and clearing the shadow layer (for drop shadow and glow)

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Custom Shadow Procedure RC V0.3
PostPosted: Tue May 28, 2013 12:53 am  (#20) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Graechan,

The shadow layer is placed below the selected layer when creating a drop shadow or a glow.

The shadow layer is placed above the selected layer when creating an inner shadow or an inner glow (inner shadow+glow).

Isn't that the way it should be?

I'm not sure I want to re-size all the layers in someone's image if they uncheck allow resizing. They might not want that.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
Post new topic Reply to topic  [ 112 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts GEGL Aura (Outer Glow and Inner Glow with flame seed) applied together

1

No new posts Attachment(s) Enhance Shadows Plug-in

2

No new posts Keep The Original Shadows | GIMP 2.10 |

1

No new posts are highlights, midtones and shadows relatively defined

2

No new posts Attachment(s) Aura/ Outer glow

3



* Login  



Powered by phpBB3 © phpBB Group