Gimp-Forum.net

Full Version: Script-Fu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, I wonder if there is a way in script-fu that can do the same job of the filters -> disorts ->  curve bend.
(12-19-2023, 10:24 AM)Alan Wrote: [ -> ]Hello, I wonder if there is a way in script-fu that can do the same job of the filters -> disorts ->  curve bend.

You can use plug-in-curve-bend()

If you go to Filters/Script-Fu/Console/Browse and type "bend" (no quotes) into the search box it will give you details of the required parameters.
(12-19-2023, 10:46 AM)programmer_ceds Wrote: [ -> ]
(12-19-2023, 10:24 AM)Alan Wrote: [ -> ]Hello, I wonder if there is a way in script-fu that can do the same job of the filters -> disorts ->  curve bend.

You can use plug-in-curve-bend()

If you go to Filters/Script-Fu/Console/Browse and type "bend" (no quotes) into the search box it will give you details of the required parameters.

Where do I get these points in the parameters?
(12-20-2023, 07:42 AM)Alan Wrote: [ -> ]Where do I get these points in the parameters?[/color]

It will be in Yellow or Red => which depend about what you chose in Green (curve-type), the number of point is also explained in Green Wink

[attachment=10905]

if you put 0 in green, you can use up to 17 points in Yellow, with coordinates all using arrays
if you put 1 in Green, you can put up to 256 points in Red, with coordinates all using arrays

Arrays > https://stackoverflow.com/questions/4309...-script-fu or https://docs.racket-lang.org/array/index.html
Try to put an integer (0 / 1) where it's written INT32 instead of the Boolean value (true / false)

explanation in the procedure browser can be.... what we don't expect Wink

[attachment=10907]

Also use the curve bend and save the curve (on your desktop) to look into it (with a text editor) might help with what is written
I got this in the file.point # there are upto 17 points where unused points are set to -1 Wink
I might be wrong, I'm not good with TinyScheme and I don't know this filter in a coding way
Code:
POINTFILE_CURVE_BEND
VERSION 1.0

# points for upper and lower smooth curve (0.0 <= pt <= 1.0)
# there are upto 17 points where unused points are set to -1
#       UPPERX     UPPERY      LOWERX    LOWERY

POINTS +0.000000  +0.500000   +0.000000  +0.500000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   +0.435294  +0.243137
POINTS +0.486275  +0.654902   -1.000000  +0.490196
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS +1.000000  +0.500000   +1.000000  +0.500000

# y values for upper/lower freehand curve (0 <= y <= 255)
# there must be exactly 256 y values
#     UPPER_Y  LOWER_Y

VAL_Y 128  127
VAL_Y 128  127
VAL_Y 128  126
VAL_Y 129  125
VAL_Y 129  125
VAL_Y 129  124
VAL_Y 130  123
VAL_Y 130  122
VAL_Y 131  121
VAL_Y 131  121
VAL_Y 131  120
VAL_Y 132  119
VAL_Y 132  118
VAL_Y 133  117
VAL_Y 133  117
VAL_Y 134  116
VAL_Y 134  115
VAL_Y 134  114
VAL_Y 135  113
VAL_Y 135  112
VAL_Y 136  112
VAL_Y 136  111
VAL_Y 137  110
VAL_Y 137  109
VAL_Y 137  108
VAL_Y 138  107
VAL_Y 138  107
VAL_Y 139  106
VAL_Y 139  105
VAL_Y 140  104
VAL_Y 140  103
VAL_Y 140  102
VAL_Y 141  102
VAL_Y 141  101
VAL_Y 142  100
VAL_Y 142   99
VAL_Y 143   98
VAL_Y 143   98
VAL_Y 143   97
VAL_Y 144   96
VAL_Y 144   95
VAL_Y 145   94
VAL_Y 145   94
VAL_Y 146   93
VAL_Y 146   92
VAL_Y 146   91
VAL_Y 147   91
VAL_Y 147   90
VAL_Y 148   89
VAL_Y 148   88
VAL_Y 148   88
VAL_Y 149   87
VAL_Y 149   86
VAL_Y 150   86
VAL_Y 150   85
VAL_Y 150   84
VAL_Y 151   84
VAL_Y 151   83
VAL_Y 152   82
VAL_Y 152   82
VAL_Y 152   81
VAL_Y 153   80
VAL_Y 153   80
VAL_Y 153   79
VAL_Y 154   78
VAL_Y 154   78
VAL_Y 154   77
VAL_Y 155   77
VAL_Y 155   76
VAL_Y 156   75
VAL_Y 156   75
VAL_Y 156   74
VAL_Y 157   74
VAL_Y 157   73
VAL_Y 157   73
VAL_Y 158   72
VAL_Y 158   72
VAL_Y 158   71
VAL_Y 158   71
VAL_Y 159   70
VAL_Y 159   70
VAL_Y 159   69
VAL_Y 160   69
VAL_Y 160   68
VAL_Y 160   68
VAL_Y 161   68
VAL_Y 161   67
VAL_Y 161   67
VAL_Y 161   66
VAL_Y 162   66
VAL_Y 162   66
VAL_Y 162   65
VAL_Y 162   65
VAL_Y 163   65
VAL_Y 163   64
VAL_Y 163   64
VAL_Y 163   64
VAL_Y 164   64
VAL_Y 164   63
VAL_Y 164   63
VAL_Y 164   63
VAL_Y 165   63
VAL_Y 165   63
VAL_Y 165   63
VAL_Y 165   62
VAL_Y 165   62
VAL_Y 165   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   66
VAL_Y 166   66
VAL_Y 166   66
VAL_Y 166   67
VAL_Y 166   67
VAL_Y 166   67
VAL_Y 166   68
VAL_Y 166   68
VAL_Y 165   68
VAL_Y 165   69
VAL_Y 165   69
VAL_Y 165   69
VAL_Y 165   70
VAL_Y 165   70
VAL_Y 164   70
VAL_Y 164   71
VAL_Y 164   71
VAL_Y 164   72
VAL_Y 164   72
VAL_Y 163   72
VAL_Y 163   73
VAL_Y 163   73
VAL_Y 163   74
VAL_Y 162   74
VAL_Y 162   75
VAL_Y 162   75
VAL_Y 162   75
VAL_Y 161   76
VAL_Y 161   76
VAL_Y 161   77
VAL_Y 161   77
VAL_Y 160   78
VAL_Y 160   78
VAL_Y 160   79
VAL_Y 160   79
VAL_Y 159   80
VAL_Y 159   80
VAL_Y 159   81
VAL_Y 158   81
VAL_Y 158   82
VAL_Y 158   82
VAL_Y 157   83
VAL_Y 157   83
VAL_Y 157   84
VAL_Y 157   84
VAL_Y 156   85
VAL_Y 156   85
VAL_Y 156   86
VAL_Y 155   86
VAL_Y 155   87
VAL_Y 155   87
VAL_Y 154   88
VAL_Y 154   88
VAL_Y 154   89
VAL_Y 153   89
VAL_Y 153   90
VAL_Y 153   90
VAL_Y 152   91
VAL_Y 152   91
VAL_Y 151   92
VAL_Y 151   93
VAL_Y 151   93
VAL_Y 150   94
VAL_Y 150   94
VAL_Y 150   95
VAL_Y 149   95
VAL_Y 149   96
VAL_Y 149   96
VAL_Y 148   97
VAL_Y 148   98
VAL_Y 147   98
VAL_Y 147   99
VAL_Y 147   99
VAL_Y 146  100
VAL_Y 146  100
VAL_Y 146  101
VAL_Y 145  102
VAL_Y 145  102
VAL_Y 144  103
VAL_Y 144  103
VAL_Y 144  104
VAL_Y 143  104
VAL_Y 143  105
VAL_Y 142  106
VAL_Y 142  106
VAL_Y 142  107
VAL_Y 141  107
VAL_Y 141  108
VAL_Y 140  109
VAL_Y 140  109
VAL_Y 140  110
VAL_Y 139  110
VAL_Y 139  111
VAL_Y 138  112
VAL_Y 138  112
VAL_Y 138  113
VAL_Y 137  113
VAL_Y 137  114
VAL_Y 136  115
VAL_Y 136  115
VAL_Y 136  116
VAL_Y 135  116
VAL_Y 135  117
VAL_Y 134  117
VAL_Y 134  118
VAL_Y 134  119
VAL_Y 133  119
VAL_Y 133  120
VAL_Y 132  120
VAL_Y 132  121
VAL_Y 132  121
VAL_Y 131  122
VAL_Y 131  123
VAL_Y 130  123
VAL_Y 130  124
VAL_Y 130  124
VAL_Y 129  125
VAL_Y 129  125
VAL_Y 129  126
VAL_Y 128  126
VAL_Y 128  127
VAL_Y 128  127
VAL_Y 128  128

for this curve

[attachment=10908]
(12-20-2023, 06:10 PM)PixLab Wrote: [ -> ]Try to put an integer (0 / 1) where it's written INT32 instead of the Boolean value (true / false)

explanation in the procedure browser can be.... what we don't expect Wink



Also use the curve bend and save the curve (on your desktop) to look into it (with a text editor) might help with what is written
I got this in the file.point # there are upto 17 points where unused points are set to -1  Wink
I might be wrong, I'm not good with TinyScheme and I don't know this filter in a coding way
Code:
POINTFILE_CURVE_BEND
VERSION 1.0

# points for upper and lower smooth curve (0.0 <= pt <= 1.0)
# there are upto 17 points where unused points are set to -1
#       UPPERX     UPPERY      LOWERX    LOWERY

POINTS +0.000000  +0.500000   +0.000000  +0.500000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   +0.435294  +0.243137
POINTS +0.486275  +0.654902   -1.000000  +0.490196
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS -1.000000  -1.000000   -1.000000  -1.000000
POINTS +1.000000  +0.500000   +1.000000  +0.500000

# y values for upper/lower freehand curve (0 <= y <= 255)
# there must be exactly 256 y values
#     UPPER_Y  LOWER_Y

VAL_Y 128  127
VAL_Y 128  127
VAL_Y 128  126
VAL_Y 129  125
VAL_Y 129  125
VAL_Y 129  124
VAL_Y 130  123
VAL_Y 130  122
VAL_Y 131  121
VAL_Y 131  121
VAL_Y 131  120
VAL_Y 132  119
VAL_Y 132  118
VAL_Y 133  117
VAL_Y 133  117
VAL_Y 134  116
VAL_Y 134  115
VAL_Y 134  114
VAL_Y 135  113
VAL_Y 135  112
VAL_Y 136  112
VAL_Y 136  111
VAL_Y 137  110
VAL_Y 137  109
VAL_Y 137  108
VAL_Y 138  107
VAL_Y 138  107
VAL_Y 139  106
VAL_Y 139  105
VAL_Y 140  104
VAL_Y 140  103
VAL_Y 140  102
VAL_Y 141  102
VAL_Y 141  101
VAL_Y 142  100
VAL_Y 142   99
VAL_Y 143   98
VAL_Y 143   98
VAL_Y 143   97
VAL_Y 144   96
VAL_Y 144   95
VAL_Y 145   94
VAL_Y 145   94
VAL_Y 146   93
VAL_Y 146   92
VAL_Y 146   91
VAL_Y 147   91
VAL_Y 147   90
VAL_Y 148   89
VAL_Y 148   88
VAL_Y 148   88
VAL_Y 149   87
VAL_Y 149   86
VAL_Y 150   86
VAL_Y 150   85
VAL_Y 150   84
VAL_Y 151   84
VAL_Y 151   83
VAL_Y 152   82
VAL_Y 152   82
VAL_Y 152   81
VAL_Y 153   80
VAL_Y 153   80
VAL_Y 153   79
VAL_Y 154   78
VAL_Y 154   78
VAL_Y 154   77
VAL_Y 155   77
VAL_Y 155   76
VAL_Y 156   75
VAL_Y 156   75
VAL_Y 156   74
VAL_Y 157   74
VAL_Y 157   73
VAL_Y 157   73
VAL_Y 158   72
VAL_Y 158   72
VAL_Y 158   71
VAL_Y 158   71
VAL_Y 159   70
VAL_Y 159   70
VAL_Y 159   69
VAL_Y 160   69
VAL_Y 160   68
VAL_Y 160   68
VAL_Y 161   68
VAL_Y 161   67
VAL_Y 161   67
VAL_Y 161   66
VAL_Y 162   66
VAL_Y 162   66
VAL_Y 162   65
VAL_Y 162   65
VAL_Y 163   65
VAL_Y 163   64
VAL_Y 163   64
VAL_Y 163   64
VAL_Y 164   64
VAL_Y 164   63
VAL_Y 164   63
VAL_Y 164   63
VAL_Y 165   63
VAL_Y 165   63
VAL_Y 165   63
VAL_Y 165   62
VAL_Y 165   62
VAL_Y 165   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 166   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   62
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   63
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   64
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   65
VAL_Y 167   66
VAL_Y 166   66
VAL_Y 166   66
VAL_Y 166   67
VAL_Y 166   67
VAL_Y 166   67
VAL_Y 166   68
VAL_Y 166   68
VAL_Y 165   68
VAL_Y 165   69
VAL_Y 165   69
VAL_Y 165   69
VAL_Y 165   70
VAL_Y 165   70
VAL_Y 164   70
VAL_Y 164   71
VAL_Y 164   71
VAL_Y 164   72
VAL_Y 164   72
VAL_Y 163   72
VAL_Y 163   73
VAL_Y 163   73
VAL_Y 163   74
VAL_Y 162   74
VAL_Y 162   75
VAL_Y 162   75
VAL_Y 162   75
VAL_Y 161   76
VAL_Y 161   76
VAL_Y 161   77
VAL_Y 161   77
VAL_Y 160   78
VAL_Y 160   78
VAL_Y 160   79
VAL_Y 160   79
VAL_Y 159   80
VAL_Y 159   80
VAL_Y 159   81
VAL_Y 158   81
VAL_Y 158   82
VAL_Y 158   82
VAL_Y 157   83
VAL_Y 157   83
VAL_Y 157   84
VAL_Y 157   84
VAL_Y 156   85
VAL_Y 156   85
VAL_Y 156   86
VAL_Y 155   86
VAL_Y 155   87
VAL_Y 155   87
VAL_Y 154   88
VAL_Y 154   88
VAL_Y 154   89
VAL_Y 153   89
VAL_Y 153   90
VAL_Y 153   90
VAL_Y 152   91
VAL_Y 152   91
VAL_Y 151   92
VAL_Y 151   93
VAL_Y 151   93
VAL_Y 150   94
VAL_Y 150   94
VAL_Y 150   95
VAL_Y 149   95
VAL_Y 149   96
VAL_Y 149   96
VAL_Y 148   97
VAL_Y 148   98
VAL_Y 147   98
VAL_Y 147   99
VAL_Y 147   99
VAL_Y 146  100
VAL_Y 146  100
VAL_Y 146  101
VAL_Y 145  102
VAL_Y 145  102
VAL_Y 144  103
VAL_Y 144  103
VAL_Y 144  104
VAL_Y 143  104
VAL_Y 143  105
VAL_Y 142  106
VAL_Y 142  106
VAL_Y 142  107
VAL_Y 141  107
VAL_Y 141  108
VAL_Y 140  109
VAL_Y 140  109
VAL_Y 140  110
VAL_Y 139  110
VAL_Y 139  111
VAL_Y 138  112
VAL_Y 138  112
VAL_Y 138  113
VAL_Y 137  113
VAL_Y 137  114
VAL_Y 136  115
VAL_Y 136  115
VAL_Y 136  116
VAL_Y 135  116
VAL_Y 135  117
VAL_Y 134  117
VAL_Y 134  118
VAL_Y 134  119
VAL_Y 133  119
VAL_Y 133  120
VAL_Y 132  120
VAL_Y 132  121
VAL_Y 132  121
VAL_Y 131  122
VAL_Y 131  123
VAL_Y 130  123
VAL_Y 130  124
VAL_Y 130  124
VAL_Y 129  125
VAL_Y 129  125
VAL_Y 129  126
VAL_Y 128  126
VAL_Y 128  127
VAL_Y 128  127
VAL_Y 128  128

for this curve
i have fixed the int32 params but still can't get a result from the script-fu, and i can't be making the image curvy and save it because i may change this image so it'ts not a practical way to use the script anymore.
My old script paste an image to the specified layer but i want to make it look real using the curve bend.
Also I can't find any documentation about this operation how to use it in script-fu.
If you go here: https://www.gimp-forum.net/Thread-Flatte...5#pid37075

You will find a script-fu curve-bend-between-paths that is a 'front-end' for the curve-bend plugin.

There should be a few hints on use inside the script.
(12-21-2023, 12:22 PM)Alan Wrote: [ -> ]And is there a way to prepare an xcf file that has a layer assigned to be curved so any image pasted image to this layer will be curved?
If yes if will be more easy than updating my script.

Looks like the "smart" object in photoshop, where you change the layer by another pic, all "smart" filters assigned to that layer will be applied to that new pic/layer
GIMP is not "smart" enough Big Grin ,
on the other-hand Krita has some "Filters' layer" and other similar "smart object", you can do your script in Python, but not sure with Scheme
Maybe more for an ImageMagick script than a Gimp script / plugin

Scale, then deform an image, then plant on the front of a mug image.

Certainly not trivial to deform but there is a script for linux / macos

http://www.fmwconcepts.com/imagemagick/cylinderize/ see the coffee cup examples
Is there any option that we create a new layer that has the curvy shape and save it as xcf so any image pasted to this layer will look curvy?
I did it with the plug-in-curve-bend but it takes a lot of data which is not practical.
If there is any easier way please let me know and thank you in advance.
Pages: 1 2