-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-background.scm
52 lines (33 loc) · 1.6 KB
/
delete-background.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(define (script-fu-delBack
theImage
theLayer
)
;Start an undo group so the process can be undone with one undo
(gimp-image-undo-group-start theImage)
(gimp-selection-none theImage)
(gimp-image-select-contiguous-color theImage 0 theLayer 0 0)
(gimp-layer-add-alpha theLayer)
(gimp-edit-bucket-fill theLayer BUCKET-FILL-BG LAYER-MODE-COLOR-ERASE 100 0 0 0 0)
;Finish the undo group for the process
(gimp-image-undo-group-end theImage)
;Ensure the updated image is displayed now
(gimp-displays-flush)
;(file-png-save RUN-NONINTERACTIVE theImage theLayer (gimp-image-get-filename theImage) (gimp-image-get-filename theImage) FALSE 9 FALSE FALSE FALSE FALSE FALSE)
;(let*((fileName (car(gimp-image-get-filename theImage)))))
(file-png-save-defaults RUN-NONINTERACTIVE theImage theLayer (car(gimp-image-get-filename theImage)) (car(gimp-image-get-filename theImage)))
;(gimp-quit 1)
)
;Register the script w/ GIMP.
(script-fu-register
"script-fu-delete-background" ;func name
"delete-background" ;menu label
"Removes a flat background colour from an image";description
"Inductiveload" ;author
"GPL" ;copyright notice
"Des. 2018" ;date created
"" ;image type that the script works on
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer to convert" 0
)
(script-fu-menu-register "script-fu-delete-background"
"<Image>/Filters/Enhance")