This is a work in progress, and I’ll add notes as I find issues.  If you notice that I could do things better, or more consisitently, please let me know directly at: https://flamingtext.com/contactus/contact-cameron.html  or you can guess my email: cameron at.

Our goal was to update scripts to 2.10 as much as possible while retaining compaitibility with 2.8.
In the end we decided to have a special legacy-2.8.scm file that would provide some “forward compatibility”.

Summary of updates:

  • globally replace some constants in the source
  • updated brush names
  • update some deprecated function names
  • updates for functions/plug-ins that behave differently.
  • added some util methods

To ensure that the scripts behaved the same, we have copies of the images of all the results from the scripts.
on a test page, we show the new script result vs the old scripts result. The left is gimp 2.10 and the right 2.08.  This is of course just a few of them.

Since we want scripts to run in 2.8 and 2.10, we define a function to determine if it’s 2.8 or 2.10

(define (is-gimp28)
 (equal? (substring (car(gimp-version)) 0 4) "2.8.")
 )
(define (is-gimp210)
 (equal? (substring (car(gimp-version)) 0 5) "2.10.")
 )
(define (is-legacy)
 (is-gimp28)
 )

Since we are trying to upgrade scripts to 2.10 as much as possible, and provide support back to 2.8, then we define the following

missing constants in legacy-2.8.scm which is only included in the 2.8 gimp engines.

(define FILL-FOREGROUND FOREGROUND-FILL)
(define FILL-BACKGROUND BACKGROUND-FILL)
(define FILL-WHITE WHITE-FILL)
(define FILL-TRANSPARENT TRANSPARENT-FILL)
(define FILL-PATTERN PATTERN-FILL)

(define BLEND-FG-BG-RGB FG-BG-RGB-MODE)
(define BLEND-FG-BG-HSV FG-BG-HSV-MODE)
(define BLEND-FG-TRANSPARENT FG-TRANSPARENT-MODE)
(define BLEND-CUSTOM CUSTOM-MODE)

(define BUCKET-FILL-FG FG-BUCKET-FILL)
(define BUCKET-FILL-BG BG-BUCKET-FILL)
(define BUCKET-FILL-PATTERN PATTERN-BUCKET-FILL)

Brushes

We were still using brushes like “Circle (05)” and “Circle Fuzzy (11)” in quite a few places.
These are gone. You might have to play around with the various settings.

    (gimp-brushes-set-brush "Circle Fuzzy (11)")

changed to

    (gimp-context-set-brush "2. Hardness 050")
    (gimp-context-set-brush-size 11)

However you could also do:

    (gimp-context-set-brush "2. Hardness 100")
    (gimp-context-set-brush-hardness 0.50)
    (gimp-context-set-brush-size 11)

For a hard single pixel brush, change from:

    (gimp-brushes-set-brush "Circle (01)")

to:

    (gimp-brushes-set-brush "1. Pixel")

Circle 05:

    (gimp-brushes-set-brush "Circle (05)")

changed to

    (gimp-context-set-brush "2. Hardness 100")
    (gimp-context-set-brush-size 5)

 

We note that these old brushes are defined as .vbr files,
https://fossies.org/linux/gimp/devel-docs/vbr.txt

Definition of Circle Fuzzy (11):

GIMP-VBR # always
1.0 # always
Circle Fuzzy (11) #name
25.000000 # spacing
5.500000 # radius px
0.500000 # hardness
1.000000 # aspect
0.000000 # angle

gimp-layer-preserver-trans

Some bug must have been fixed as if this is TRUE, then gimp-edit-clear
will no longer clear the pixels.

In one case I had:

 (gimp-layer-set-preserve-trans text-layer TRUE)
 ... do some stuff...
 (gimp-edit-clear text-layer)

replace with:

 (gimp-layer-set-preserve-trans text-layer TRUE)
 ... do some stuff ...
 (gimp-layer-set-preserve-trans text-layer FALSE)
 (gimp-edit-clear text-layer)
 (gimp-layer-set-preserve-trans text-layer TRUE)

*plug-in-bump-map*

plug-in-bump-map : two of the arguments changed from INT to FLOAT.  Where INT 0-255, now FLOAT 0-1.  We used a function to handle the conversion to float: (gimp28-int 30)

was in 2.8

 (plug-in-bump-map 1 img text-layer blur-layer 135 50 10 0 0 0 30 TRUE FALSE 0)

now:

 (plug-in-bump-map 1 img text-layer blur-layer 135 50 10 0 0 (gimp28-int 0) (gimp28-int 30) TRUE FALSE 0)

*plug-in-wind*

The wind direction in 2.10 is “the other way” from 2.8
in 2.8
Direction: 0 LEFT (Wind from the LEFT)
Direction: 1 RIGHT
To get the same effect, they should be reversed in 2.10, so we use the function: (gimp28-wind 0)

was:

 (plug-in-wind RUN-NONINTERACTIVE img sound-blast-layer windThreshold 1 windStrength WIND 1)

now:

 (plug-in-wind RUN-NONINTERACTIVE img sound-blast-layer windThreshold (gimp28-wind 1) windStrength WIND 1)

*plug-in-sparkle*

In 2.10, it doesn’t seem to work on a mask, and I think there are other problems.  But what did work was white dots on a transparent layer.  So you work on a layer, and then convert it to a mask.  Perhaps the luminance arg doesn’t work. I ended up just using white.

This one is a bit trickier to fix, so I’ll just leave the code.  To get the same sparkles, I had to have two different verisons:

 

  (if(= bsparkles TRUE)
      ; in gimp 2.10.18 is seems like sparkle doesn't work on a mask
      ; so we make a layer, and copy it to the mask.
     (if (is-gimp28)
	(begin
                ; ft-fill is a basically draws an outline around the text.
                ; FILL_PARAMS is a macro that expands out the outline parameters.
		(ft-fill sparkle-layer FILL_PARAMS(outline-))
		(set! sparkmask (car (gimp-layer-create-mask sparkle-layer 1))) ; 1=BLACK MASK
		(gimp-layer-add-mask sparkle-layer sparkmask)
		(gimp-selection-load chantext)
		(gimp-selection-grow img XXshadgrow) ; 5
		(plug-in-randomize-hurl	RUN-NONINTERACTIVE
					img
					sparkmask
					50		; randomization percentage
					1		; repeat
					random-sparkles	; random seed
					(rand)		; seed (graine)
					)
		(gimp-threshold	sparkmask 253 255); low high
		(gimp-selection-none img)
	
		(plug-in-sparkle	RUN-NONINTERACTIVE
					img
					sparkmask
					0.001		; lum
					0.50		; intensity
					sparkle-len	; spike len ; 20
					4		; spike nbr
					15		; angle
					1.00		; density
					0		; opacity
					0		; random hue
					0		; random saturation
					FALSE		; preserve lum
					FALSE		; invert
					FALSE		; add border
					0		; color type 0=NATURAL
					)
	
	)
	; else !gimp-28
      (let* (
		 (cam-layer (car (gimp-layer-new  img width height RGBA-IMAGE "CamSparkle" 100 NORMAL-MODE)))
	     )
    		(gimp-selection-none img)
		(gimp-image-add-layer img cam-layer -1)
		(gimp-context-set-foreground '(0 0 0))
		(gimp-edit-clear cam-layer)
		(gimp-drawable-fill cam-layer FILL-FOREGROUND)
		(gimp-selection-load chantext)
		(gimp-selection-grow img XXshadgrow) ; 5
		(plug-in-randomize-hurl	RUN-NONINTERACTIVE
					img
					cam-layer
					50		; randomization percentage
					1		; repeat
					random-sparkles		; random seed
					(rand)		; seed (graine)
					)
		(gimp-threshold	cam-layer 253 255 ); low high
		(gimp-selection-none img)
		(plug-in-sparkle	RUN-NONINTERACTIVE
					img
					cam-layer
					0.001		; lum
					0.50		; intensity
					sparkle-len	; spike len ; 20
					4		; spike nbr
					15		; angle
					1.00		; density
					0		; opacity
					0		; random hue
					0		; random saturation
					FALSE		; preserve lum
					FALSE		; invert
					FALSE		; add border
					0		; color type 0=NATURAL
					)
		(ft-fill sparkle-layer FILL_PARAMS(outline-))
		(set! sparkmask (car (gimp-layer-create-mask sparkle-layer ADD-BLACK-MASK))) ; 1=BLACK MASK
		(gimp-layer-add-mask sparkle-layer sparkmask)
		; copy layer to mask
		(gimp-edit-copy cam-layer)
		(define floating-sel (car (gimp-edit-paste sparkmask TRUE)))
		(gimp-floating-sel-anchor floating-sel)
		(gimp-drawable-set-visible cam-layer FALSE)
		)
      )
     )

*plug-in-plasma*

turbulence > 7 now is an error
appears there is a bug in 2.10
in scheme, if you create a text layer, and select the text, and then run
plasma on it, the padding to the top and left appear as black on plasma.  This doesn’t happen in the interface.

was:

 (gimp-layer-set-preserve-trans text-layer TRUE)
 (plug-in-plasma 1 img text-layer seed turbulence)

now:

 (gimp-layer-set-preserve-trans text-layer TRUE)
 (gimp-selection-none img)
 (plug-in-plasma 1 img text-layer seed turbulence)

*plug-in-spread*

This replaced by gegl, but the spread is different.
The new spread is “more” spread.  I don’t have a good solution here yet.

Deprecated functions

Here are the list of deprecated functions we updated:

gimp-blend => gimp-edit-blend
gimp-bucket-fill => gimp-edit-bucket-fill

We still had some references to gimp-palette-set-foreground/background.

gimp-palette-set-background => gimp-context-set-background
gimp-palette-set-foreground => gimp-context-set-foreground

In the old-old way, you would do something like:

; at start
         (set! old-fg (car (gimp-palette-get-foreground)))
         (set! old-bg (car (gimp-palette-get-background)))
; in middle
    (gimp-palette-set-background bg-color)
    (gimp-palette-set-foreground '(0 0 0))
; at end
    (gimp-palette-set-foreground old-fg)
    (gimp-palette-set-background old-bg)

but since a long time ago, it’s better form to do:

; at start
    (gimp-context-push)
; in middle
    (gimp-context-set-background bg-color)
    (gimp-context-set-foreground '(0 0 0))
; at end
    (gimp-context-pop)

list of deprecated functions that we didn’t update, but may do later.

gimp-color-picker => gimp-image-pick-color
gimp-convert-rgb => gimp-image-convert-rgb
gimp-convert-grayscale => gimp-image-convert-grayscale
gimp-convert-indexed => gimp-image-convert-indexed
gimp-crop => gimp-image-crop

gimp-channel-get-image-id => gimp-drawable-get-image
gimp-channel-delete => gimp-drawable-delete
gimp-channel-get-name => gimp-drawable-get-name
gimp-channel-set-name => gimp-drawable-set-name
gimp-channel-get-visible => gimp-drawable-get-visible
gimp-channel-set-visible => gimp-drawable-set-visible
gimp-channel-get-tattoo => gimp-drawable-get-tattoo
gimp-channel-set-tattoo => gimp-drawable-set-tattoo

gimp-channel-ops-offset => gimp-drawable-offset #SAME interface, can just change the name
gimp-channel-ops-duplicate => gimp-image-duplictate

gimp-layer-get-image-id => gimp-drawable-get-image
gimp-layer-delete => gimp-drawable-delete
gimp-layer-get-name => gimp-drawable-get-name
gimp-layer-set-name => gimp-drawable-set-name
gimp-layer-get-visible => gimp-drawable-get-visible
gimp-layer-set-visible => gimp-drawable-set-visible
gimp-layer-get-linked => gimp-drawable-get-linked
gimp-layer-set-linked => gimp-drawable-set-linked
gimp-layer-get-tattoo => gimp-drawable-get-tattoo
gimp-layer-set-tattoo => gimp-drawable-set-tattoo
gimp-layer-is-floating-selection => gimp-layer-is-floating-sel
gimp-layer-get-preserve-transparency => gimp-layer-get-preserve-trans
gimp-layer-set-preserve-transparency => gimp-layer-set-preserve-trans

gimp-layer-mask => gimp-layer-get-mask
gimp-layer-get-mask-id => gimp-layer-get-mask

gimp-drawable-image => gimp-drawable-get-image
gimp-drawable-image-id => gimp-drawable-get-image
gimp-drawable-name => gimp-drawable-get-name
gimp-drawable-visible => gimp-drawable-get-visible
gimp-drawable-bytes => gimp-drawable-bpp

gimp-image-active-drawable => gimp-image-get-active-drawable
gimp-image-floating-selection => gimp-image-get-floating-sel
gimp-image-add-layer-mask(i,l,m) => gimp-layer-add-mask(l,m)
gimp-image-remove-layer-mask(i,l,m) => gimp-layer-remove-mask(l,m)

gimp-gradients-get-active => gimp-gradients-get-gradient
gimp-gradients-set-active => gimp-gradients-set-gradient

gimp-palette-refresh => gimp-palettes-refresh

gimp-temp-PDB-name => gimp-procedural-db-temp-name

gimp-undo-push-group-start => gimp-image-undo-group-start
gimp-undo-push-group-end => gimp-image-undo-group-end

gimp-interactive-selection-brush => gimp-brush-select-new
gimp-brush-select-widget => gimp-brush-select-widget-new
gimp-brush-select-widget-set-popup => gimp-brush-select-widget-set
gimp-brush-select-widget-close-popup => gimp-brush-select-widget-close

gimp-interactive-selection-font => gimp-font-select-new
gimp-gradient-select-widget => gimp-gradient-select-widget-new
gimp-gradient-select-widget-set-popup => gimp-gradient-select-widget-set
gimp-gradient-select-widget-close-popup => gimp-gradient-select-widget-close

gimp-interactive-selection-gradient => gimp-gradient-select-new
gimp-font-select-widget => gimp-font-select-widget-new
gimp-font-select-widget-set-popup => gimp-font-select-widget-set
gimp-font-select-widget-close-popup => gimp-font-select-widget-close

gimp-interactive-selection-pattern => gimp-pattern-select-new
gimp-pattern-select-widget => gimp-pattern-select-widget-new
gimp-pattern-select-widget-set-popup => gimp-pattern-select-widget-set
gimp-pattern-select-widget-close-popup => gimp-pattern-select-widget-close

Scheme global variables

We updated any reference to of the globals on the left to the new global on the right.

WHITE-MASK => ADD-WHITE-MASK
BLACK-MASK => ADD-BLACK-MASK
ALPHA-MASK => ADD-ALPHA-MASK
SELECTION-MASK => ADD-SELECTION-MASK
COPY-MASK => ADD-COPY-MASK

ADD => CHANNEL-OP-ADD
SUB => CHANNEL-OP-SUBTRACT
REPLACE => CHANNEL-OP-REPLACE
INTERSECT => CHANNEL-OP-INTERSECT

FG-BG-RGB => FG-BG-RGB-MODE => BLEND-FG-BG-RGB
FG-BG-HSV => FG-BG-HSV-MODE => BLEND-FG-BG-HSV
FG-TRANS => FG-TRANSPARENT-MODE => BLEND-FG-TRANSPARENT
CUSTOM => CUSTOM-MODE => BLEND-CUSTOM

FG-IMAGE-FILL => FOREGROUND-FILL => FILL-FOREGROUND
BG-IMAGE-FILL => BACKGROUND-FILL => FILL-BACKGROUND
WHITE-IMAGE-FILL => WHITE-FILL => FILL-WHITE
TRANS-IMAGE-FILL => TRANSPARENT-FILL => FILL-TRANSPARENT

APPLY => MASK-APPLY
DISCARD => MASK-DISCARD

HARD => BRUSH-HARD
SOFT => BRUSH-SOFT

CONTINUOUS => PAINT-CONSTANT
INCREMENTAL => PAINT-INCREMENTAL

HORIZONTAL => ORIENTATION-HORIZONTAL
VERTICAL => ORIENTATION-VERTICAL
UNKNOWN => ORIENTATION-UNKNOWN

LINEAR => GRADIENT-LINEAR
BILNEAR => GRADIENT-BILINEAR
RADIAL => GRADIENT-RADIAL
SQUARE => GRADIENT-SQUARE
CONICAL-SYMMETRIC => GRADIENT-CONICAL-SYMMETRIC
CONICAL-ASYMMETRIC => GRADIENT-CONICAL-ASYMMETRIC
SHAPEBURST-ANGULAR => GRADIENT-SHAPEBURST-ANGULAR
SHAPEBURST-SPHERICAL => GRADIENT-SHAPEBURST-SPHERICAL
SHAPEBURST-DIMPLED => GRADIENT-SHAPEBURST-DIMPLED
SPIRAL-CLOCKWISE => GRADIENT-SPIRAL-CLOCKWISE
SPIRAL-ANTICLOCKWISE => GRADIENT-SPIRAL-ANTICLOCKWISE

VALUE-LUT => HISTOGRAM-VALUE
RED-LUT => HISTOGRAM-RED
GREEN-LUT => HISTOGRAM-GREEN
BLUE-LUT => HISTOGRAM-BLUE
ALPHA-LUT => HISTOGRAM-ALPHA

TODO

  • script-fu-register doesn’t allow paths to the menu.  We have a lot of these.  Need to call (script-fu-menu-register … ).
  • Our signature animated fire (flamingtext) doesn’t work the same.
  • in script-fu-server, I think the results come back as quoted now, but they didn’t before, more investigation needed.

Leave a Reply