02-01-2023, 09:35 AM
(This post was last modified: 02-01-2023, 09:46 AM by salamander017.)
(01-31-2023, 11:25 AM)Ofnuts Wrote:(01-30-2023, 01:35 PM)salamander017 Wrote:I didn't say to use layers as explicit parameters to the script. Of course, when you do do, layer1 is implicitly the active layer ("drawable"(*),actually) in the image, but Gimp can't tell what layer2 should be so you get the dialog.(01-29-2023, 09:10 PM)Ofnuts Wrote: You don't need to set active layers... The layer argument of the (plugin-exchange) is the layer on which it will act, so this should be layer1 or layer2.
Otherwise, without changing colors, if you change the top layer to Difference blend mode, you will get white spots where the layers differ.
What I said is that (plug-in-exchange) doesn't run on the active drawable but on the drawable that you pass in its arguments.So you can take any layer of the image and give it to (plug-in-exchange) without making it active first.
So, if you remove your two SF_DRAWABLE, given just the image, you can get a list of its layers ((gimp-image_get-layers)) and then extract each of the two layers from that list and pass it to (plug-in-exchange).
(*) A "drawable" is anything you can paint on: layer, but also mask or channel. Or a layer group, on which you can't paint.
I have updated the script, but now I get an Error: not enough arguments
I may have wrong idea about the (gimp-image-get-layers) so please correct me
(define (script-fu-gimpcompare2 image layers layer1 layer2)
(let*(
(layers (gimp-image-get-layers image))
(layer1 (car(car(cdr layers))))
(layer2 (car(cdr(car(cdr layers)))))
)
(plug-in-exchange RUN-NONINTERACTIVE image layer1 0 0 0 0 0 255 0 0 0)
(plug-in-exchange RUN-NONINTERACTIVE image layer2 0 0 0 255 0 0 0 0 0)
(gimp-layer-set-mode layer1 LAYER-MODE-MULTIPLY)
(gimp-displays-flush)
)
)
(script-fu-register
"script-fu-gimpcompare2"
"<Image>/Script-Fu/gimpcompare2"
"blue red multiply"
"Test"
"Test"
"2022"
"RGB*"
SF-IMAGE "Image" 0
)