{"id":378,"date":"2012-02-18T20:09:59","date_gmt":"2012-02-19T02:09:59","guid":{"rendered":"http:\/\/rrbits.com\/epb\/?p=378"},"modified":"2012-02-18T20:25:14","modified_gmt":"2012-02-19T02:25:14","slug":"solved-gimp-script-fu-console-image-id","status":"publish","type":"post","link":"https:\/\/rrbits.com\/epb\/2012\/02\/18\/solved-gimp-script-fu-console-image-id\/","title":{"rendered":"Solved: GIMP Script-Fu Console Image ID"},"content":{"rendered":"<p><strong>Problem:<\/strong> In experimenting with GIMP&#8217;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.\u00a0 It was surprisingly simple though.<\/p>\n<p><!--more--><\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>Image ID: The image ID to use is displayed in the image window&#8217;s titlebar.\u00a0 For example in &#8220;DianeLatest.jpg-<strong>4.0<\/strong>&#8221; the 4 is the image id.\u00a0 The zero after the dot is the view id. (Might be useful to know, but I don&#8217;t know where you&#8217;d use it.)<\/p>\n<p>Drawable: For simplicity&#8217;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.<\/p>\n<p><strong>Example:<\/strong> (script-fu-round-corners 1 (car (gimp-image-get-active-drawable 1)) 30 1 6 6 20 1 0)<\/p>\n<p>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.\u00a0 [Details: Corners have a radius of 30, shadow is offset 6 pixels to the right and 6 pixels down.\u00a0 Shadow is blurred by 20 pixels.] (The color of the background layer appears to be taken from the currently active background color.)<\/p>\n<p><strong>Notes:<\/strong><\/p>\n<ol>\n<li>The procedure browser shows a run-mode parameter for script-fu functions.\u00a0 Don&#8217;t provide it, GIMP does that for you.<\/li>\n<li>The (car &#8230;) 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.<\/li>\n<li>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&#8217;s an alpha channel on the layer.\u00a0 You can tell because it&#8217;s layer-name will be in bold if it does not have one.<\/li>\n<\/ol>\n<p>Here&#8217;s the result of the command I used as an example:<\/p>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2012\/02\/cordelia_sample.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-382\" title=\"Cordelia (Rounded Corner Sample)\" src=\"https:\/\/rrbits.com\/epb\/files\/2012\/02\/cordelia_sample.jpg\" alt=\"\" width=\"480\" height=\"400\" srcset=\"https:\/\/rrbits.com\/epb\/files\/2012\/02\/cordelia_sample.jpg 480w, https:\/\/rrbits.com\/epb\/files\/2012\/02\/cordelia_sample-300x250.jpg 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a>\n","protected":false},"excerpt":{"rendered":"<p>Problem: In experimenting with GIMP&#8217;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.\u00a0 It was surprisingly simple though.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[178],"tags":[4242],"class_list":["post-378","post","type-post","status-publish","format-standard","hentry","category-problems","tag-gimp"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/comments?post=378"}],"version-history":[{"count":5,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/378\/revisions"}],"predecessor-version":[{"id":381,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/378\/revisions\/381"}],"wp:attachment":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/media?parent=378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/categories?post=378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/tags?post=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}