It is currently 09 Dec 2019, 00:47


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | 🡆 GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Wonder if this Script works in GIMP 10

Resources used in GIMP that aren't Python Fu or Scheme Fu (files other than .py or .scm files)
Post Reply
Pegleg44
Forum Member

Wonder if this Script works in GIMP 10

Post#1 by Pegleg44 » 11 Nov 2019, 03:02


I'm thinking about using gimp 10 one day but need to find out if some old scripts from 2.8 work. Here's the one I use the most. It turns a selection into a gradient selection that is defined by a saved curves preset.

Can someone test it out for me?

Code: Select all

(define (script-fu-v-shape-selection-for-pegleg44 image layer 
			border-width-pixels
			color-curve-preset
         )
	
		(let* 
		   (
		   (width (car (gimp-image-width image)))
		   (height (car (gimp-image-height image)))
		   )
			;(gimp-image-undo-disable image); DN = NO UNDO
			(gimp-context-push)
			(gimp-image-undo-group-start image)                   ;undo-group in one step
			

		; 1. This first step would have to be interactive and have a dialog box to set the width of the resulting selection. [Select] [border] The feather would always be on, and the only part that needs to be interactive is the amount in pixels.
			(gimp-context-set-feather TRUE) ;seems to have no effect as border seem to feather always...hmmmm oh well that's what we want anyways so we're in luck
			(gimp-selection-border image border-width-pixels)
		;2. Go into Quick Mask Mode [Select] [Toggle Quick Mask].
            ;duplicate
			;add layer mask - selection
			;select all
			;apply curves
			;apply layer mask
			;delete duplicated layer
			;(define new-channel (car (gimp-channel-new image width height "selection" 0 '(0 0 0))))
			;(gimp-image-insert-channel image new-channel 0 0)
			
			;(define new-layer (car (gimp-layer-copy layer TRUE)))
			(define layer-copy layer)
			;(gimp-image-insert-layer image layer-copy 0 0)
			(define mask-selection (car (gimp-layer-create-mask layer-copy ADD-SELECTION-MASK)))
			(gimp-layer-add-mask layer-copy mask-selection)
			(gimp-selection-all image)
			;(gimp-layer-set-apply-mask layer-copy FALSE)
			(python-fu-apply-color-curves-preset 1 image mask-selection color-curve-preset)
			;(gimp-image-select-item image mask-selection CHANNEL-OP-REPLACE)
			;(gimp-layer-set-apply-mask layer-copy TRUE)
			(gimp-selection-load mask-selection)
			(gimp-layer-remove-mask layer-copy MASK-DISCARD)
			
		;3. Run a Curves preset that I have on my computer called RoundBlack [Colors] [Curves] [RoundBlack] - If this could NOT be interactive then that would be good, but if it has to be then it would be ok

		;4. Come out of Quick Mask Mode [Select] [Toggle Quick Mask]	
		   ;(gimp-image-undo-enable image) ;DN = NO UNDO
			(gimp-image-undo-group-end image)                     ;undo group in one step
			(gimp-context-pop)
			(gimp-displays-flush)
	    )
	
	
    
) ;end of define
(script-fu-register
  "script-fu-v-shape-selection-for-pegleg44"         ;function name
  "<Image>/HEIGHT TOOLS/Selection to Border (Interactive)"    ;menu register
  "Uses a Selection to Create a User Defined Border Selection"       ;description
  "Tin Tran"                          ;author name
  "copyright info and description"         ;copyright info or description
  "2016"                          ;date
  "RGB*, GRAY*"                        ;mode
  SF-IMAGE      "Image" 0                   
  SF-DRAWABLE   "Layer" 0
  ;SF-GRADIENT   "Gradient 1"           ""
  ;SF-GRADIENT   "Gradient 2"           ""
  SF-ADJUSTMENT   "Border width pixels" '(50 0 1000 1 10 0 0)
  SF-OPTION     "Color Curves Preset" (strbreakup (car (python-fu-get-color-curves-presets-names 1)) ",")
)
0

Krikor
Forum Member

Post#2 by Krikor » 11 Nov 2019, 18:49


@Pegleg44 which menu do I find this script in?
Last edited by Krikor on 11 Nov 2019, 19:03, edited 1 time in total.
All that is great is greater than all that is small.
0

Krikor
Forum Member

Post#3 by Krikor » 11 Nov 2019, 18:58


This is what I get when I try to use this script:
Krikor getregcurves test
Krikor getregcurves test
ErrorGetCurves.png (11.07 KiB) Viewed 377 times
All that is great is greater than all that is small.
0

Krikor
Forum Member

Post#4 by Krikor » 11 Nov 2019, 19:12


@Pegleg44 ok, the script is working perfectly on my gimp 2.10.12 :thumbsup: :2_Thumbs:
All that is great is greater than all that is small.
1

Pegleg44
Forum Member

Post#5 by Pegleg44 » 14 Nov 2019, 00:48


It might actually create a new pull down menu called Height Tools. That's good to know that it works but I have other ones too.

Like this one that's called Path to Darken Layer which uses the selected path layer and makes a selection out of it and turns the selection into a darken only drawing layer that is cropped to the edges and the lock alpha channel button turned on.

;script as described by PegLeg44 here: http://gimpchat.com/viewtopic.php?f=9&t=14046
;-----------------------------------------------------------------------------------


;rel 1. changed previous script to Path To Darken Layer
;rel 2. set default colors to black and white before running script
;rel 3. changed according to comments and put layer above selected layer instead of top of stack.
(define (script-fu-path-to-darken-layer image layer
)

(let*
(
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(active-vectors 0)
(new-layer 0)
(layer-position 0)
)
;(gimp-image-undo-disable image); DN = NO UNDO
(gimp-context-push)
(gimp-image-undo-group-start image) ;undo-group in one step


;0. Set default colors to black and white before running script
(gimp-context-set-default-colors)

;1. I turn the path to a [Selection] [From Path].
(set! active-vectors (car (gimp-image-get-active-vectors image)))
(gimp-image-select-item image CHANNEL-OP-REPLACE active-vectors)

;2. I create a new white layer. --CHANGE TO TRANSPARENT AND NEXT LAYER UP INSTEAD OF TOP LAYER IN STACKING ORDER--
(set! new-layer (car (gimp-layer-new image width height
RGBA-IMAGE "new transparent" 100 NORMAL-MODE)))
;(gimp-drawable-fill new-layer WHITE-FILL) ;fills background with white
(set! layer-position (car (gimp-image-get-item-position image layer)))
(gimp-image-insert-layer image new-layer 0 layer-position) ;parent 0, insert layer on top position(0)

;3. And fill the selection with black [Fill with Foreground Color]. --CHANGE TO WHITE--
(gimp-edit-fill new-layer WHITE-FILL)

;4. And then un-select [Select] [None].
(gimp-selection-none image)

;5. Then I run the [Colors] [Threshold] on the layer (with the standard 127 and 255 setting). --CHANGE TO RUN "plug-in-threshold-alpha"
;(gimp-threshold new-layer 127 255)
(plug-in-threshold-alpha 1 image new-layer 127)

;6. And run [Layers] [Transparency] [Color to Alpha] on it. --DON'T NEED THIS--
;(plug-in-colortoalpha 1 image new-layer '(255 255 255))

;7. Then click the button [Lock Alpha Channel] at the top of the layers dockable dialog.
(gimp-layer-set-lock-alpha new-layer TRUE)

;8. Change the layer mode to [Darken Only]
(gimp-layer-set-mode new-layer DARKEN-ONLY-MODE)

;9. And finally use [Colors] [Invert] on it to make the black white. --DON'T NEED THIS--
;(gimp-invert new-layer)

;10. 10 run the [Layer] [Transparency] [Alpha to Selection] and then
(gimp-image-select-item image CHANNEL-OP-REPLACE new-layer)

;step 11 [Layer] [Crop to Selection]
(plug-in-autocrop-layer 1 image new-layer)

;(gimp-image-undo-enable image) ;DN = NO UNDO
(gimp-image-undo-group-end image) ;undo group in one step
(gimp-context-pop)
(gimp-displays-flush)
)



) ;end of define
(script-fu-register
"script-fu-path-to-darken-layer" ;function name
"<Image>/HEIGHT TOOLS/Path To Darken Layer" ;menu register
"Builds a New Layer with a Sharp Transparency From a Path" ;description
"Tin Tran" ;author name
"copyright info and description" ;copyright info or description
"2016" ;date
"RGB*, GRAY*" ;mode
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
;SF-STRING "Text" "Gimp Chat"
)
0

Krikor
Forum Member

Post#6 by Krikor » 14 Nov 2019, 16:59


I don't know exactly what this script should do.
But he made no mistake, and it was very fast.

I was unaware of the premises for testing this script. I read a little on the pages indicated by the link.

I just drew a path on a white background. I kept Foreground as black and Background as white and ran the script.

The image shows the before and after.
Krikor - PathToDarken REf Pegleg44
Krikor - PathToDarken REf Pegleg44
PathtoDarkenV002B.png (49.56 KiB) Viewed 321 times
Tested on Gimp 2.10.14


P.S: The previous script (getcurves) also ran well in Gimp 2.10.14.
All that is great is greater than all that is small.
1

tim
GL Blogger

Post#7 by tim » 15 Nov 2019, 02:59


Thanks for testing them Krikor.
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1

Krikor
Forum Member

Post#8 by Krikor » 17 Nov 2019, 00:24


tim wrote:
15 Nov 2019, 02:59
Thanks for testing them Krikor.
@tim ,
Before I had tested this script on versions 2.10.12 and 2.10.14 and it ran perfectly without errors.
Now I don't remember changing anything, but in version 2.10.12 it displays this message when I try to update the scripts (Refresh)

Refresh Scripts Warning
Error while loading C:\Users\...\PegLeg44.scm:

Error: (C:\Users\...\PegLeg44.scm : 68) eval: unbound variable: python-fu-get-color-curves-presets-names



With version 2.10.14 I use the addonCollectionManager-3.0 Addon, and the tests the other day worked without problems, but now neither the script loads nor the Python-fu menu appears when I try to load this script. But if I call another script that is on this menu it appears normally.

Could you elucidate this mystery?
Thx.

Ps: This is the script that appears as Get RGB Curves in the Python_Fu menu.
All that is great is greater than all that is small.
0

tim
GL Blogger

Post#9 by tim » 17 Nov 2019, 01:53


python-fu-get-color-curves-presets-names is another script maybe you don't have that one that's why it's saying unbound variable means it's not there.
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1

Krikor
Forum Member

Post#10 by Krikor » 17 Nov 2019, 15:00


tim wrote:
17 Nov 2019, 01:53
python-fu-get-color-curves-presets-names is another script maybe you don't have that one that's why it's saying unbound variable means it's not there.
It would appear to be the script I found at http://gimpchat.com/viewtopic.php?f=9&t=14064. Just for persistence would give a verified.
Thx Tim.
All that is great is greater than all that is small.
0


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | 🡆 GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply
  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

Who is online

Users browsing this forum: No registered users and 19 guests