It is currently 19 Feb 2018, 02:13

GIMP Python Fu ScriptsNew Darken Layer from Visible plug-in for GIMP (Showcase | Slideshow)

Share your Python Fu scripts for GIMP here
User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 4/9
Posts: 2155
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,887.02 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1193
x 256
Contact:
Canada

New Darken Layer from Visible plug-in for GIMP

Post#1 by tim » 21 Feb 2017, 18:35


This is to fulfill a script request by PegLeg44: New Darken Layer from Visible Script request
The steps that this script does is described in the Script request.

:download:
new_darken_layer_from_visisble.zip #
Zipped .py file (unzip and put in your GIMP's /plug-ins/ folder)
(1.71 KiB) Downloaded 27 times
new_darken_layer_from_visisble (2).zip #
Crops layer instead of image as asked for.
(1.71 KiB) Downloaded 27 times
new_darken_layer_from_visisble (3).zip #
Selection None as step 0
(1.73 KiB) Downloaded 30 times
new_darken_layer_from_visisble (4).zip #
adds layer on top of active layer instead of topmost
(1.74 KiB) Downloaded 34 times
Script location: Python-Fu -> New Darken Layer From Visible
0 x



aka Tin
Image gimplearn.net                                              

Registered members enjoy ads-free content
User avatar
Pegleg44
Forum Member
View: Showcase | Slideshow
Topic Posts: 3/9
Posts: 43
Joined: 29 Nov 2016, 03:12
Cash on hand: 258.13 GLP
x 11
Gimp Nation

Post#2 by Pegleg44 » 21 Feb 2017, 20:36


Hi Tim

It works good except that it crops the whole image at the end instead of just the layer. I tried to fix it by changing image to layer in this line but it didn't work.

Code: Select all

#9. [Layer] Crop to Selection]
	pdb.plug_in_autocrop(layer,new_visible)
Yes the white 255 works. I think that is the default when you use that Color to Alpha function.
0 x




User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 4/9
Posts: 2155
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,887.02 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1193
x 256
Contact:
Canada

Post#3 by tim » 21 Feb 2017, 20:49


You need version 2.
Or change the code to

Code: Select all

#9. [Layer] Crop to Selection]
	pdb.plug_in_autocrop_layer(image,new_visible)
	
0 x



aka Tin
Image gimplearn.net                                              

User avatar
Pegleg44
Forum Member
View: Showcase | Slideshow
Topic Posts: 3/9
Posts: 43
Joined: 29 Nov 2016, 03:12
Cash on hand: 258.13 GLP
x 11
Gimp Nation

Post#4 by Pegleg44 » 21 Feb 2017, 21:25


Ya, I just plugged that in and it works great. But only now I noticed that if I have a selection active before running the plug-in it will make an opaque rectangle with white space around the new darken layer instead of making it see through fitting the contour.

So if you could add one more step:
0. [Select] [Select None]

That would make it work no matter what, selection or no selection.

You're a good scripter. Are you starting to do more python type stuff now? Some of those others that were similar that you did for me were SCM files.
0 x




User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 4/9
Posts: 2155
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,887.02 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1193
x 256
Contact:
Canada

Post#5 by tim » 21 Feb 2017, 21:35


You need version 3 now that does selection none as step 0.

I like python more. It's easier to type without all the brackets and more powerful.
0 x



aka Tin
Image gimplearn.net                                              

User avatar
Pegleg44
Forum Member
View: Showcase | Slideshow
Topic Posts: 3/9
Posts: 43
Joined: 29 Nov 2016, 03:12
Cash on hand: 258.13 GLP
x 11
Gimp Nation

Post#6 by Pegleg44 » 21 Feb 2017, 22:08


Got it and it works fantastic. Thank you very much Tim
0 x




User avatar
Pat625
Script Tester
View: Showcase | Slideshow
Topic Posts: 2/9
Posts: 2226
Joined: 28 Sep 2016, 03:35
Cash on hand: 13,183.01 GLP
Gender: Gal
Location: USA
Operating System: Windows
GIMP Version: 2.8.22
x 8
x 465
United States of America

Post#7 by Pat625 » 21 Feb 2017, 22:16


Tin, You amaze me with how fast you can write those scripts!
0 x




Post Reply

Last 20 Members Who Visited This Topic

User avatar gnerd (2), akaawol (1), User avatar Pat625 (2), User avatar tim (1)

  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments Only) •
1: gnerd
2: tim
3: oldmangrumpy
4: RJKD
5: leopardo-40
6: gnerd
7: gnerd

Who is online

Users browsing this forum: No registered users and 1 guest