Problem: In experimenting with GIMP’s Script-Fu console, I could not figure out what values to feed in to scriptfu-rounded-corners (you know, to see what would happen) for image and drawable. It was surprisingly simple though.
Solution:
Image ID: The image ID to use is displayed in the image window’s titlebar. For example in “DianeLatest.jpg-4.0” the 4 is the image id. The zero after the dot is the view id. (Might be useful to know, but I don’t know where you’d use it.)
Drawable: For simplicity’s sake when I was testing I just took the active drawable for the image, which you can get from (car (gimp-image-get-active-drawable [IMAGEID]) where the [IMAGEID] is replaced by the number you have for the image.
Example: (script-fu-round-corners 1 (car (gimp-image-get-active-drawable 1)) 30 1 6 6 20 1 0)
This adds uses script-fu to add rounded corners, a drop-shadow, and a background layer to the active drawable (usually a layer) of image #1. [Details: Corners have a radius of 30, shadow is offset 6 pixels to the right and 6 pixels down. Shadow is blurred by 20 pixels.] (The color of the background layer appears to be taken from the currently active background color.)
Notes:
- The procedure browser shows a run-mode parameter for script-fu functions. Don’t provide it, GIMP does that for you.
- The (car …) function is required because the drawable parameter is expecting a number, but scheme functions return lists, so car is used to grab the first item from the list produced by gimp-image-get-active-drawable.
- More specific to rounding corners this way: If you just want to round the corners of an image and have a transparent background, make sure there’s an alpha channel on the layer. You can tell because it’s layer-name will be in bold if it does not have one.
Here’s the result of the command I used as an example:
Thank you for that post. I was desperately searching the API on howto get the image ID from the script-fu console. My window manager does not have a window decoration, so I used
xtitle
to get the id.