Skip to content

Commit 980e049

Browse files
committed
0.20250206: scheme: add methods interpolation
1 parent 91891b3 commit 980e049

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

scheme/resize-ris.scm

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(define (resize-ris image
22
drawable
33
newwidth
4-
newheight)
4+
newheight
5+
method)
56
(let*
67
(
78
(drawable (car (gimp-image-active-drawable image)))
@@ -19,15 +20,36 @@
1920
(gimp-layer-set-mode new-layer-2 LAYER-MODE-MULTIPLY-LEGACY)
2021
(set! new-layer-1 (car (gimp-image-merge-down image new-layer-2 EXPAND-AS-NECESSARY)))
2122

23+
(cond
24+
((= method 0)
25+
(gimp-context-set-interpolation INTERPOLATION-CUBIC)
26+
)
27+
((= method 1)
28+
(gimp-context-set-interpolation INTERPOLATION-NONE)
29+
)
30+
((= method 2)
31+
(gimp-context-set-interpolation INTERPOLATION-LINEAR)
32+
)
33+
((= method 3)
34+
(gimp-context-set-interpolation INTERPOLATION-CUBIC)
35+
)
36+
((= method 4)
37+
(gimp-context-set-interpolation INTERPOLATION-NOHALO)
38+
)
39+
((= method 5)
40+
(gimp-context-set-interpolation INTERPOLATION-LOHALO)
41+
)
42+
)
43+
2244
(gimp-image-insert-layer image new-layer-3 0 -1)
23-
(gimp-layer-scale new-layer-3 newwidth newheight INTERPOLATION-CUBIC)
24-
(gimp-layer-scale new-layer-3 oldwidth oldheight INTERPOLATION-CUBIC)
45+
(gimp-layer-scale new-layer-3 newwidth newheight TRUE)
46+
(gimp-layer-scale new-layer-3 oldwidth oldheight TRUE)
2547

2648
(gimp-layer-set-mode new-layer-3 LAYER-MODE-DIVIDE-LEGACY)
2749
(set! new-layer-1 (car (gimp-image-merge-down image new-layer-3 EXPAND-AS-NECESSARY)))
2850
(gimp-item-set-name new-layer-1 "RIS")
2951

30-
(gimp-image-scale-full image newwidth newheight INTERPOLATION-CUBIC)
52+
(gimp-image-scale image newwidth newheight)
3153

3254
(gimp-displays-flush)
3355

@@ -46,6 +68,7 @@
4668
SF-DRAWABLE "Drawable" 0
4769
SF-VALUE "Width" "1024"
4870
SF-VALUE "Height" "1024"
71+
SF-OPTION "Method" '("Cubic" "None" "Linear" "Cubic" "NoHalo" "LowHalo")
4972
)
5073

5174
(script-fu-menu-register "resize-ris" "<Image>/Image/Transform")

0 commit comments

Comments
 (0)