[Gimp-user] Script-fu Gimp
Hi I want to apply curve to number of images using script-fu in Gimp. Can you please help. -- monty (via gimpusers.com) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-menu-register with space in folder name?
On Mon Oct 25 10:03:38 PDT 2010 Sven Neumann said: but if I try, subfolder Joint Scripts doens't appear Any way to get a space in a subfolder name? Are you sure? I wonder how all the scripts in the Alpha to Logo folder register themselves then. Perhaps you should register the menu branch first? Can you perhaps show us a simple example script to illustrate the problem? No. Now I can't replicate problem. Tried all sorts of ways. Must have been something else I screwed up in script. Sorry to bother. Yrs, Alan Recedite, plebes! Gero rem imperialem!: Stand aside plebians! I am on imperial business. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu Illegal Function Error
Try getting rid of the double parenthesis around the gimp-image-get-active-vectors. -Rob A Bingo! You are right. You have my undying gratitude. I played with this thing so long I don't know how the extra parenthesis got there. This kind of structure is new to me. I first learned programming on punch cards with the MAD (Michigan Algorithm Decoder) and am still line oriented. This tread is closed. -- Aitchbee (via gimpusers.com) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu Illegal Function Error
I am getting an “Illegal Function” error message for a Script-Fu script I wrote. Can anyone tell me what I am doing wrong? The script is supposed to make a selection from the active path (vector), fill the selection with the foreground color and stroke the selection with the active brush. I have run the entire script and the “define” part through the Script-Fu console with out any errors. The individual commands also work when I enter them in the console. I am running Gimp 2.6.8 with an Ubuntu 10.4 operating system. The script also shows an illegal function with Windows7. Here is the script: (define (script-fu-colorline image drawable) (let* ((MyVector (car ((gimp-image-get-active-vectors image) (gimp-image-undo-group-start image) ;This clears the active layer (gimp-edit-clear drawable) (gimp-vectors-to-selection MyVector CHANNEL-OP-REPLACE TRUE FALSE 5 5) (gimp-edit-fill drawable FOREGROUND-FILL) (gimp-edit-stroke drawable) (gimp-selection-none image) (gimp-image-undo-group-end image) (gimp-displays-flush) ) ) (script-fu-register script-fu-colorline Colorline Color as path Harlan Boise (c) Harlan Boise October 16, 2010 RGB* GRAY* SF-IMAGEMyImage 0 SF-DRAWABLE MyDrawable 0 ) (script-fu-menu-register script-fu-colorline Image/Script-Fu/Tutorials) Can anyone help? -- Aitchbee (via gimpusers.com) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu Illegal Function Error
Try getting rid of the double parenthesis around the gimp-image-get-active-vectors. -Rob A ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-menu-register with space in folder name?
On Sun, 2010-10-24 at 20:24 +, Alan Campbell wrote: I'd like to do (script-fu-menu-register some_func Image/File/Create/Joint Scripts) but if I try, subfolder Joint Scripts doens;t appear (script-fu-menu-register some_func Image/File/Create/JointScripts) works fine. Any way to get a space in a subfolder name? Are you sure? I wonder how all the scripts in the Alpha to Logo folder register themselves then. Perhaps you should register the menu branch first? Can you perhaps show us a simple example script to illustrate the problem? Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu-menu-register with space in folder name?
I'd like to do (script-fu-menu-register some_func Image/File/Create/Joint Scripts) but if I try, subfolder Joint Scripts doens;t appear (script-fu-menu-register some_func Image/File/Create/JointScripts) works fine. Any way to get a space in a subfolder name? gimp-plugin-menu-branch-register shows same behaviour. Yrs, Alan If you don't know where you're going, you're never lost. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu script defaults
Hello people. A couple of years ago, I wrote a script to add titles to images. I offer the options of position, color and combination mode in the dialog. I use this script quite often. I never found if it is possible to assign default values to the variables, eg. set the color dialog by default to gray 25%, or set a dropdown selection to a particular value. (I know, in this case I could simply change the order of the items, but still...) If this is documented somewhere, I'd appreciate a pointer. John ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
Quoting Alan Campbell gimp-u...@alancampbelllists.ukfsn.org: Always got the Woodrat folder under File | Create menu, no shortcut key indicated. On 3 Oct 2010 at 11:17:05, Sven Neumann wrote: I am pretty sure that it theoretically should work this way. After all the Script-Fu extension itself creates sub-menus this way and those sub-menus do have mnemonics. You definitely should not use the underscore in the menu-register call. I was calling (gimp-plugin-menu-branch-register from top level, i.e. it was a statement in scm file along with many (defines. So how does that work? script-fu interpreter processes defines first, then any (script-fu-register*) statements, nothing else? Any other precedence rules? It is not a problem with the branch register command not being processed, but that branch registration seems to require that plug-in be associated with it (see 'plugin_menu_branch_register_invoker()' in app/pdb/plug-in-cmds.c). Apparently, when processed at the top level of a Script-fu, there is no current-active-plugin; and this leads to 'gimp_marshal_VOID__STRING_STRING_STRING' failing because it is missing one of its parameters (the plug-in name). I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A clever solution. However, I was unable to make it work with GIMP 2.6.10+. What version of GIMP are you using? Anyway, my kludge seems to work. Thanks for pointer on how to do it. I'm not sure how robust your kludge is. If it is not version specific then it may be working for you (and not me) because of something other going on than just the code you posted here (multiple procedure registrations in the same file perhaps). Could you provide a complete listing of your script? Regards. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
On 4 Oct 2010 at 10:21:16 PDT saulgoode at flashingtwelve.brickfilms.com wrote: It is not a problem with the branch register command not being processed, but that branch registration seems to require that plug-in be associated with it (see 'plugin_menu_branch_register_invoker()' in app/pdb/plug-in-cmds.c). Apparently, when processed at the top level of a Script-fu, there is no current-active-plugin; and this leads to 'gimp_marshal_VOID__STRING_STRING_STRING' failing because it is missing one of its parameters (the plug-in name). Don't have source code, so I'll pass on the c. But I get the idea. I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create/W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A clever solution. However, I was unable to make it work with GIMP 2.6.10+. What version of GIMP are you using? 2.6.10 win32 on XP. Anyway, my kludge seems to work. Thanks for pointer on how to do it. I'm not sure how robust your kludge is. If it is not version specific then it may be working for you (and not me) because of something other going on than just the code you posted here (multiple procedure registrations in the same file perhaps). Could you provide a complete listing of your script? 2000 lines overall, 1200 lines of code. Perhaps a bit excessive to paste into a posting here. So for moment it's in woodrat.zip at https://docs.google.com/leaf?id=0B6M_pjcD- RRwNTZjODc0NzQtYjliMy00ZDBlLTgzZWItNDAyNDExMTA2YzU3hl=enauthkey=CMGn 5i4 or http://bit.ly/btzFxD or http://www.freedrive.com/folder/282054 In version posted I invoke (wr_register_menu_branch) 3 times, with argument (the value to return each time). It also worked for me when I just invoked it once (on the first (script-fu-register)). Any comments or crits on code very welcome, e.g. if you happen to notice me doing anything wildly inefficient. To actually run the script you need the pattern file included in the zip. Yrs, Alan Never put anything smaller than your elbow into your ear. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
One of uses of an underscore is to pick out the shortcut character in a menu item: (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label Create Template for Half blind Dovetail ) There also appears to be (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ... ) whch I gather has something to do with translation: I assume it would have no effect in this particular case because it's sadly unreasonable to expect translation dictionaries (po files??) to know blind or dovetail. That so? == script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ) Also, I've been using this style of getting a script registered for use in create menu: (script-fu-menu-register wrdhb_create_template_half_blind_dovetail Image/File/Create/Woodrat) (a) Can I combine the two, putting path in second parameter of script-fu-register? (b) Is there anyway of getting a letter of the submenu Woodrat to be a shortcut key? I've tried variations of underscore in the Image/File/Create/Woodrat parameter, doesn't work. Yrs, Alan Never accept a drink from a urologist. -- Erma Bombeck = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
On Sun, 2010-10-03 at 12:59 +, Alan Campbell wrote: One of uses of an underscore is to pick out the shortcut character in a menu item: (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label Create Template for Half blind Dovetail ) There also appears to be (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ... ) whch I gather has something to do with translation: I assume it would have no effect in this particular case because it's sadly unreasonable to expect translation dictionaries (po files??) to know blind or dovetail. That so? If you want your scripts to be translated, then you need to put your scripts into a separate translation domain and ship the translations with them. You can of course not expect the strings from your scripts to be part of the standard script-fu translation domain. Also, I've been using this style of getting a script registered for use in create menu: (script-fu-menu-register wrdhb_create_template_half_blind_dovetail Image/File/Create/Woodrat) (a) Can I combine the two, putting path in second parameter of script-fu-register? Using a path in the script-fu-register call is deprecated. Please use script-fu-menu-register. (b) Is there anyway of getting a letter of the submenu Woodrat to be a shortcut key? I've tried variations of underscore in the Image/File/Create/Woodrat parameter, doesn't work. You need to explicitly create the submenu using gimp-plugin-menu-branch-register. This procedure should accept mnemonics marked with an underscore. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
Hi Sven, On 3 Oct 2010 at 14:19, Sven Neumann wrote: On Sun, 2010-10-03 at 12:59 +, Alan Campbell wrote: One of uses of an underscore is to pick out the shortcut character in a menu item: (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label Create Template for Half blind Dovetail ) There also appears to be (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ... ) whch I gather has something to do with translation: I assume it would have no effect in this particular case because it's sadly unreasonable to expect translation dictionaries (po files??) to know blind or dovetail. That so? If you want your scripts to be translated, then you need to put your scripts into a separate translation domain and ship the translations with them. You can of course not expect the strings from your scripts to be part of the standard script-fu translation domain. Yikes. Okay, will now go find out what a translation domain is. However, since woodrats I think are only sold only with English instructions, I guess their owners will probably read engish... Also, I've been using this style of getting a script registered for use in create menu: (script-fu-menu-register wrdhb_create_template_half_blind_dovetail Image/File/Create/Woodrat) (a) Can I combine the two, putting path in second parameter of script-fu-register? Using a path in the script-fu-register call is deprecated. Please use script-fu-menu-register. Have done, thanks. (b) Is there anyway of getting a letter of the submenu Woodrat to be a shortcut key? I've tried variations of underscore in the Image/File/Create/Woodrat parameter, doesn't work. You need to explicitly create the submenu using gimp-plugin-menu-branch-register. This procedure should accept mnemonics marked with an underscore. Tried (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) (gimp-plugin-menu-branch-register Image/File/Create _Woodrat) followed by (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/W_oodrat) or (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/_Woodrat) or (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/Woodrat) Always got the Woodrat folder under File | Create menu, no shortcut key indicated. Yrs, Alan Law of Cybernetic Entomology: There is always one more bug. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
On Sun, 2010-10-03 at 13:42 +, Alan Campbell wrote: You need to explicitly create the submenu using gimp-plugin-menu-branch-register. This procedure should accept mnemonics marked with an underscore. Tried (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) (gimp-plugin-menu-branch-register Image/File/Create _Woodrat) followed by (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/W_oodrat) or script-fu-menu- (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/_Woodrat) or (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/Woodrat) Always got the Woodrat folder under File | Create menu, no shortcut key indicated. I am pretty sure that it theoretically should work this way. After all the Script-Fu extension itself creates sub-menus this way and those sub-menus do have mnemonics. You definitely should not use the underscore in the menu-register call. However the problem is most likely that Script-Fu doesn't provide you any means to call this procedure before the menu-register call is executed. There would probably have to be a script-fu-menu-branch-register() wrapper added for this purpose. A possible solution would be to write your scripts in Python. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
Always got the Woodrat folder under File | Create menu, no shortcut key indicated. On 3 Oct 2010 at 11:17:05, Sven Neumann wrote: I am pretty sure that it theoretically should work this way. After all the Script-Fu extension itself creates sub-menus this way and those sub-menus do have mnemonics. You definitely should not use the underscore in the menu-register call. I was calling (gimp-plugin-menu-branch-register from top level, i.e. it was a statement in scm file along with many (defines. So how does that work? script-fu interpreter processes defines first, then any (script-fu-register*) statements, nothing else? Any other precedence rules? However the problem is most likely that Script-Fu doesn't provide you any means to call this procedure before the menu-register call is executed. There would probably have to be a script-fu-menu-branch-register() wrapper added for this purpose. I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A possible solution would be to write your scripts in Python. Oh dear. I've had enough mental exercise for this year learning script-fu. Not sure by brain could take relearning python. Also that would require that end users of script, generally assumed not to be highly computer literate, would have to install python as well as GIMP. Anyway, my kludge seems to work. Thanks for pointer on how to do it. Yrs, Alan Never say anything on the phone that you wouldn't want your mother to hear at your trial. -- Sydney Biddle Barrows the Mayflower Madam = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
Quoting Alan Campbell gimp-u...@alancampbelllists.ukfsn.org: That's really an abuse of the gimprc though. So it's really only meant for GIMP and GIMP plugin settings? I agree with Sven that using gimprc for this purpose is inappropriate. Also it looks like once I've called gimp-gimprc-set, no way to remove expunge evil deed from the gimprc file? Correct. it would be quite a task to remove your script-generated settings from the gimprc while retaining the user's configuration choices (as well as the script-generated settings of other scripts, assuming they likewise employed gimprc). In addition, storing script data in gimprc would somewhat break the documentation for gimprc. While a few scripts adding settings to gimprc would be acceptable (which is why those PDB functions are exposed), if this became convention then gimprc might soon become cluttered with undocumented settings. But the worst aspect of scripts saving data in gimprc is that the gimp-gimprc-set function interacts with the file every time it is invoked (whereas the parasiterc file is only rewritten upon GIMP exit). It is not really a good idea to have a script reading, parsing, and writing back a file each time it is executed -- doing so makes your script dependent upon file system speeds (it is also conceivable in theory that your script will be iteratively executed hundreds of times in rapid succession). It is far better conceptually to manipulate such data in memory, and saving the data only upon exit. It would be much better to get the parasites problem fixed. Sure. I'm not in no hurry. Lots more wrok to do on my woodrat scripts. Any guess re timescale? Keep in mind that even should the bug be fixed today, if you are sharing your script with others then you will want it to work with versions of GIMP which are in current use. Thus I would recommend using the work-around previously provided (if your script isn't intended for general distribution, you needn't worry about this). It would probably be a year or two before you could reasonably expect that most users would have updated to a fixed version. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
On 10 Sep 2010 at 9:35, Rob Antonishen wrote: Ta for reply. use the https://bugzilla.gnome.org/show_bug.cgi?id=572865 Thanks, got that working. Instead of parasites consider using gimp_gimprc_set() and gimp_gimprc_query() which don't seem to have this issue. In Script-fu console (gimp_gimprc_set xxx ) on my win 2.6.10 installation gives Error: eval: unbound variable: gimp_gimprc_set Did I miss something? Yrs, Alan No one is listening until you make a mistake. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
On Sat, 2010-09-11 at 16:53 +, Alan Campbell wrote: On 10 Sep 2010 at 9:35, Rob Antonishen wrote: https://bugzilla.gnome.org/show_bug.cgi?id=572865 Thanks, got that working. Instead of parasites consider using gimp_gimprc_set() and gimp_gimprc_query() which don't seem to have this issue. In Script-fu console (gimp_gimprc_set xxx ) on my win 2.6.10 installation gives Error: eval: unbound variable: gimp_gimprc_set Did I miss something? In Script-Fu it's gimp-gimprc-set. That's really an abuse of the gimprc though. It would be much better to get the parasites problem fixed. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
On Sat, 2010-09-11 at 16:53 +, Alan Campbell wrote: On 11 Sep 2010 at 12:26, Sven Neumann wrote: In Script-Fu it's gimp-gimprc-set. Works, ta. That's really an abuse of the gimprc though. So it's really only meant for GIMP and GIMP plugin settings? Also it looks like once I've called gimp-gimprc-set, no way to remove expunge evil deed from the gimprc file? It would be much better to get the parasites problem fixed. Sure. I'm not in no hurry. Lots more wrok to do on my woodrat scripts. Any guess re timescale? Yrs, Alan Sometimes I wonder if men and women really suit each other. Perhaps they should live next door and just visit now and then. -- Katharine Hepburn = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
Hi Saul, Many thanks for instant help. I'm trying to figure ut if there's any way that choices made by user in dialog widgets can be remembered and used as values of those widgets next time dialog runs. That is precisely how script dialogs currently behave; the last used values are presented. These last values will be reset to their original default values if 1) Script-fu is refreshed (Filters-Script-fu-Refresh Scripts) or 2) GIMP is restarted. Sorry, I mis-stated my problem. I'd like dialog to come up with same widget values next time GIMP is started up. ...(snip)... Tick quoting does not result in evaluation of the list elements. Use 'list' so that WRF_BIT_WIDTH gets evaluated and replaced by its numeric value: Thanks, I think it I read that bit in the Scheme manual and forgot it. ...(snip)... If, however, the issue you are attempting to address is having the last values retained across sessions (or survive a Script Refresh), this would be possible by storing your script's last values in the gimpdir/parasiterc file: (define (script-fu-woodrat image drawable bit-width) ; Substitute function owing to buggy parasite-attach behavior (define (fu-parasite-attach parasite) (gimp-parasite-attach parasite) (while (not (string=? (caddr parasite) (caddar (gimp-parasite-find (car parasite) (gimp-parasite-attach parasite))) ; Save the user-specified bit-width to an application parasite (fu-parasite-attach (list WRF_BIT_WIDTH 1 (number-string bit- width))) ... ) (script-fu-register script-fu-woodrat : : : SF-IMAGE ... SF-DRAWABLE ... SF-VALUE Bit width (catch 17 ; fallback value if first-time run (string-number (caddar (gimp-parasite-find WRF_BIT_WIDTH))) ) Note that 'gimp-parasite-find' is only executed once: when GIMP is initially loaded (or if scripts are refreshed). Even though the parasite is saved every time the script is executed, it is actually GIMP's internally stored last value (not the parasite) that is used in determining the value for the 'bit-width' parameter. The only reason you'd want to take these steps is to support last values across different sessions. The behavior you desired (as expressed in the first paragraph of your post) is already supported by GIMP. Sorry, mis-stated by requirement. parasites are just what I need. Can't find much about them. (list WRF_BIT_WIDTH 1 (number-string bit-width))) First list member: parasite ID string. What's the second list member? Flags, I understand from one search result I found. Used? Third list member: parasite value (must always be a string). So an RGB colour value would have to be stringified. unstrbreakup maybe? Generally: do all the gimp-*-parasite-attach methods suffer from same bug, so should be reapplied til they work? Yrs, Alan Public speaking is very easy. -- Vice President Dan Quayle to reporters in 10/88 = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
Quoting Alan Campbell gimp-u...@alancampbelllists.ukfsn.org: parasites are just what I need. Can't find much about them. (list WRF_BIT_WIDTH 1 (number-string bit-width))) First list member: parasite ID string. What's the second list member? Flags, I understand from one search result I found. Used? To my knowledge, the FLAGS parameter controls 1) whether the parasite is persistent across sessions, and 2) whether adding the parasite is an UNDOable operation. 1) is controlled by the least significant bit of FLAGS, while 2) is controlled by the second bit. This results in four possible settings: 0 - Not persistent and not UNDOable 1 - Persistent and not UNDOable 2 - Not persistent and UNDOable 3 - Persistent and UNDOable Third list member: parasite value (must always be a string). So an RGB colour value would have to be stringified. unstrbreakup maybe? That would work. (set! color (car (gimp-context-get-foreground))) ; as an example (set! str (unbreakupstr (map number-string color) )) : : (set! color (map string-number (strbreakup str ))) Generally: do all the gimp-*-parasite-attach methods suffer from same bug, so should be reapplied til they work? I believe so. Yes. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu: saving dialog choices
Hi, I'm trying to figure ut if there's any way that choices made by a user in dialog widgets can be remembered and used as values of those widgets next time dialog runs. In most other scripting languages I'd save choices to somethng like an ini file, and retrieve stored ini file values before displaying dialog. Hmm. Ok, a few problems: (a) How to run code before dialog displays. I tried this at top level (i.e. not enclosed within any procedure: (load F:\\test.scm) where test.scm contained (define WRF_BIT_WIDTH_SETTINGS '(17 0 256 0.1 1 1 1)) ; and script-fu-register dialog def included SF-ADJUSTMENT bit width: WRF_BIT_WIDTH_SETTINGS That seemed to work. (Now I've just got to figure out how to write out valid define statements to test.scm and I'm partly there. Looks like a combination of calls to write-char and write obj may do.) BUT: if loaded scm contains (define WRF_BIT_WIDTH 17) and script-fu-register dialog def includes: SF-ADJUSTMENT bit width: '(WRF_BIT_WIDTH 0 256 0.1 1 1 1) the value of WRF_BIT_WIDTH loaeded from test.scm doesn't seem to take. Any thoughts as to why? Another approach I tried was to begin declaration of dialog (script-fu-register WRF_DIALOG_FUNCTION (wrf_test_text) ;menu label Create a Finger Template for Woodrat ;description . SF-ADJUSTMENT bit width: WRF_BIT_WIDTH_SETTINGS where (wrf_test_text) is (define (wrf_test_text) (set! WRF_BIT_WIDTH_SETTINGS '(17 0 256 0.1 1 1 1)) . Finger... ; return value ) which also seemed to work; in principle I could write code for (wrf_test_text) that interrogated an ini file, retrieved values, constructed correct lists, initialised variables used in later parameters of script-fu-register. Rather round-the-houses, but works. === (b) But: to make this work I need to be able to determine if a file exists (error if try to load file that doesn't) and to be well- behaved, be able to specify a particular folder in which to look for ini files (same folder as running script? GIMP install folder? GIMP share\gimp\2.0\..?). Any way to test for file existence or determine script folder/install folder in script-fu? Thanks for any help. Yrs, Alan It costs me never a stab nor squirm, To tread by chance upon a worm. Aha, my little dear, I say, Your clan will pay me back one day. -- Dorothy Parker = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
Quoting Alan Campbell gimp-u...@alancampbelllists.ukfsn.org: Hi, I'm trying to figure ut if there's any way that choices made by a user in dialog widgets can be remembered and used as values of those widgets next time dialog runs. That is precisely how script dialogs currently behave; the last used values are presented. These last values will be reset to their original default values if 1) Script-fu is refreshed (Filters-Script-fu-Refresh Scripts) or 2) GIMP is restarted. BUT: if loaded scm contains (define WRF_BIT_WIDTH 17) and script-fu-register dialog def includes: SF-ADJUSTMENT bit width: '(WRF_BIT_WIDTH 0 256 0.1 1 1 1) the value of WRF_BIT_WIDTH loaeded from test.scm doesn't seem to take. Tick quoting does not result in evaluation of the list elements. Use 'list' so that WRF_BIT_WIDTH gets evaluated and replaced by its numeric value: SF-ADJUSTMENT bit width: (list WRF_BIT_WIDTH 0 256 0.1 1 1 1) Another approach I tried was to begin declaration of dialog (script-fu-register WRF_DIALOG_FUNCTION (wrf_test_text) ;menu label : : which also seemed to work; in principle I could write code for (wrf_test_text) that interrogated an ini file, retrieved values, constructed correct lists, initialised variables used in later parameters of script-fu-register. Rather round-the-houses, but works. Keep in mind that the arguments of 'script-fu-register' only get evaluated when the script is registered -- they are not (re-)evaluated when the script is executed. While your code works, you have not really gained anything other than moving the definitions to a different location within the .scm file. (b) But: to make this work I need to be able to determine if a file exists (error if try to load file that doesn't) and to be well- behaved, be able to specify a particular folder in which to look for ini files (same folder as running script? GIMP install folder? GIMP share\gimp\2.0\..?). Any way to test for file existence or determine script folder/install folder in script-fu? It is unclear to me what exactly you mean by to make this work because within a GIMP session, the values set in script dialogs are indeed retained and used the next time the script is executed. If you are wishing to have the values derived at the time the script is run (i.e., calculated before the dialog is presented), this is not readily accomplished. For example, you can't have a size parameter default to the run-time width of the image being filtered -- the initial size default would be evaluated at registration time, and for subsequent executions the previous value entered by the user would be used. If, however, the issue you are attempting to address is having the last values retained across sessions (or survive a Script Refresh), this would be possible by storing your script's last values in the gimpdir/parasiterc file: (define (script-fu-woodrat image drawable bit-width) ; Substitute function owing to buggy parasite-attach behavior (define (fu-parasite-attach parasite) (gimp-parasite-attach parasite) (while (not (string=? (caddr parasite) (caddar (gimp-parasite-find (car parasite) (gimp-parasite-attach parasite))) ; Save the user-specified bit-width to an application parasite (fu-parasite-attach (list WRF_BIT_WIDTH 1 (number-string bit-width))) ... ) (script-fu-register script-fu-woodrat : : : SF-IMAGE ... SF-DRAWABLE ... SF-VALUE Bit width (catch 17 ; fallback value if first-time run (string-number (caddar (gimp-parasite-find WRF_BIT_WIDTH))) ) Note that 'gimp-parasite-find' is only executed once: when GIMP is initially loaded (or if scripts are refreshed). Even though the parasite is saved every time the script is executed, it is actually GIMP's internally stored last value (not the parasite) that is used in determining the value for the 'bit-width' parameter. The only reason you'd want to take these steps is to support last values across different sessions. The behavior you desired (as expressed in the first paragraph of your post) is already supported by GIMP. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Dillon wrote: (set! num-layers (car (gimp-image-get-layers newimage))) (set! layerIDs (cadr (gimp-image-get-layers newimage))) What error messages do you get when the above lines are included? (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) The declarations for variables fileparts through to drawable are wrong. You must provide an initial value when defining a variable in a let block. The simple solution is to add a 0 or -1 to the declarations for numeric variables and string variables. Any value will work but it helps to stick to the a value similar to the type of value the variable could typically hold. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
It just says: batch command experienced an execution error (Type any character to close this window) Is there a way to get the batch engine to provide more verbose output? You're probably right about the variable declarations. Doh! On Sat, Jul 24, 2010 at 4:11 AM, Cameron Gregory c...@bloke.com wrote: what is the error? But you need to declare num-layers and layerID's at the top (like newimage and drawable) Cameron On 24/07/2010, at 3:35 PM, Dillon wrote: As soon as I add in either of these lines: (set! num-layers (car (gimp-image-get-layers newimage))) (set! layerIDs (cadr (gimp-image-get-layers newimage))) I get batch command execution errors. The full script is: (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) (gimp-message-set-handler 2) (gimp-message Preparing to act on the following files) (gimp-message pattern) (while (pair? filelist) ; set filename to the name of the current file in the glob (set! filename (car filelist)) (gimp-message The current file is: ) (gimp-message filename) ; set xcfname by tokenizing on . and taking everything but the last part (set! fileparts (strbreakup filename .)) (set! fileparts (butlast fileparts)) (set! xcfname (string-append (unbreakupstr fileparts .) .xcf)) (gimp-message The new filename will be: ) (gimp-message xcfname) ; set image from the file, and then get the first layer and set it to newimage (gimp-message Loading File.) (set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (set! num-layers (car (gimp-image-get-layers newimage))) (set! layerIDs (cadr (gimp-image-get-layers newimage))) ; set drawable to the newimage (gimp-message Setting the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) (set! filelist (cdr filelist)) ) ) ) Date: Sun, 06 Jun 2010 17:46:15 -0400 From: saulgo...@flashingtwelve.brickfilms.com Subject: Re: [Gimp-user] Script-Fu for batch image conversion To: gimp-user@lists.XCF.Berkeley.EDU Message-ID: 20100606174615.awibbw09xk44k...@flashingtwelve.brickfilms.com Content-Type: text/plain; charset=ISO-8859-1; DelSp=Yes; format=flowed Quoting Dillon dillonontheco...@gmail.com: The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. In that case, you were on the right track originally with using 'gimp-image-get-layers' (I am also assuming multi-page TIFFs load as separate layers). However, you had incorrectly handled the value returned by the function. 'gimp-image-get-layers' returns returns a list containing two elements: the number of layers in the image and an array of the layerIDs of those layers: (set! num-layers (car (gimp-image-get-layers image))) (set! layerIDs (cadr (gimp-image-get-layers image))) You can obtain the layerID of the top layer with: (set! top-layer (vector-ref layerIDs 0)) The next down with: (set! next-layer (vector-ref layerIDs 1)) And so on: (set! bottom-layer (vector-ref layerIDs (- num-layers 1))) If you know the position of the layer you wish to keep (the TIFF page), you can then remove all of the other layers from the image with: (set! pos 0) (while ( pos num-layers) (unless (= pos TIFFpage) (gimp-image-remove-layer image (vector-ref layerIDs pos)) ) (set! i (+ i 1)) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Jun 2010 17:46:15 -0400 From: saulgo...@flashingtwelve.brickfilms.com Subject: Re: [Gimp-user] Script-Fu for batch image conversion To: gimp-user@lists.XCF.Berkeley.EDU Message-ID: 20100606174615.awibbw09xk44k...@flashingtwelve.brickfilms.com Content-Type: text/plain; charset=ISO-8859-1; DelSp=Yes; format=flowed Quoting Dillon dillonontheco...@gmail.com: The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. In that case, you were on the right track originally with using 'gimp-image-get-layers' (I am also assuming multi-page TIFFs load as separate layers). However, you had incorrectly handled the value returned by the function. 'gimp-image-get-layers' returns returns a list containing two elements: the number of layers in the image and an array of the layerIDs of those layers: (set! num-layers (car (gimp-image-get-layers image))) (set! layerIDs (cadr (gimp-image-get-layers image))) You can obtain the layerID of the top layer with: (set! top-layer (vector-ref layerIDs 0)) The next down with: (set! next-layer (vector-ref layerIDs 1)) And so on: (set! bottom-layer (vector-ref layerIDs (- num-layers 1))) If you know the position of the layer you wish to keep (the TIFF page), you can then remove all of the other layers from the image with: (set! pos 0) (while ( pos num-layers) (unless (= pos TIFFpage) (gimp-image-remove-layer image (vector-ref layerIDs pos)) ) (set! i (+ i 1)) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) (set! filelist (cdr filelist)) ) ) ) Date: Sun, 06 Jun 2010 17:46:15 -0400 From: saulgo...@flashingtwelve.brickfilms.com Subject: Re: [Gimp-user] Script-Fu for batch image conversion To: gimp-user@lists.XCF.Berkeley.EDU Message-ID: 20100606174615.awibbw09xk44k...@flashingtwelve.brickfilms.com Content-Type: text/plain; charset=ISO-8859-1; DelSp=Yes; format=flowed Quoting Dillon dillonontheco...@gmail.com: The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. In that case, you were on the right track originally with using 'gimp-image-get-layers' (I am also assuming multi-page TIFFs load as separate layers). However, you had incorrectly handled the value returned by the function. 'gimp-image-get-layers' returns returns a list containing two elements: the number of layers in the image and an array of the layerIDs of those layers: (set! num-layers (car (gimp-image-get-layers image))) (set! layerIDs (cadr (gimp-image-get-layers image))) You can obtain the layerID of the top layer with: (set! top-layer (vector-ref layerIDs 0)) The next down with: (set! next-layer (vector-ref layerIDs 1)) And so on: (set! bottom-layer (vector-ref layerIDs (- num-layers 1))) If you know the position of the layer you wish to keep (the TIFF page), you can then remove all of the other layers from the image with: (set! pos 0) (while ( pos num-layers) (unless (= pos TIFFpage) (gimp-image-remove-layer image (vector-ref layerIDs pos)) ) (set! i (+ i 1)) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Quoting Dillon dillonontheco...@gmail.com: Sorry for being unclear - when I said this line I was referring to: (set! num-layers (car (gimp-image-get-layers newimage))) On Sat, Jul 24, 2010 at 9:50 AM, Dillon dillonontheco...@gmail.com wrote: Here is the code: : : (set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (set! num-layers (car (gimp-image-get-layers newimage))) : : The error is most likely owing to a failure of the file to load properly. Try running the command: (batch-save-as-xcf pattern) in the Script-fu console (provide the full path to a TIFF file as 'pattern'). ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
As soon as I add in either of these lines: (set! num-layers (car (gimp-image-get-layers newimage))) (set! layerIDs (cadr (gimp-image-get-layers newimage))) I get batch command execution errors. The full script is: (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) (gimp-message-set-handler 2) (gimp-message Preparing to act on the following files) (gimp-message pattern) (while (pair? filelist) ; set filename to the name of the current file in the glob (set! filename (car filelist)) (gimp-message The current file is: ) (gimp-message filename) ; set xcfname by tokenizing on . and taking everything but the last part (set! fileparts (strbreakup filename .)) (set! fileparts (butlast fileparts)) (set! xcfname (string-append (unbreakupstr fileparts .) .xcf)) (gimp-message The new filename will be: ) (gimp-message xcfname) ; set image from the file, and then get the first layer and set it to newimage (gimp-message Loading File.) (set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (set! num-layers (car (gimp-image-get-layers newimage))) (set! layerIDs (cadr (gimp-image-get-layers newimage))) ; set drawable to the newimage (gimp-message Setting the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) (set! filelist (cdr filelist)) ) ) ) Date: Sun, 06 Jun 2010 17:46:15 -0400 From: saulgo...@flashingtwelve.brickfilms.com Subject: Re: [Gimp-user] Script-Fu for batch image conversion To: gimp-user@lists.XCF.Berkeley.EDU Message-ID: 20100606174615.awibbw09xk44k...@flashingtwelve.brickfilms.com Content-Type: text/plain; charset=ISO-8859-1; DelSp=Yes; format=flowed Quoting Dillon dillonontheco...@gmail.com: The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. In that case, you were on the right track originally with using 'gimp-image-get-layers' (I am also assuming multi-page TIFFs load as separate layers). However, you had incorrectly handled the value returned by the function. 'gimp-image-get-layers' returns returns a list containing two elements: the number of layers in the image and an array of the layerIDs of those layers: (set! num-layers (car (gimp-image-get-layers image))) (set! layerIDs (cadr (gimp-image-get-layers image))) You can obtain the layerID of the top layer with: (set! top-layer (vector-ref layerIDs 0)) The next down with: (set! next-layer (vector-ref layerIDs 1)) And so on: (set! bottom-layer (vector-ref layerIDs (- num-layers 1))) If you know the position of the layer you wish to keep (the TIFF page), you can then remove all of the other layers from the image with: (set! pos 0) (while ( pos num-layers) (unless (= pos TIFFpage) (gimp-image-remove-layer image (vector-ref layerIDs pos)) ) (set! i (+ i 1)) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu-round-corners
Hi List, I circulated a script yesterday for rounding corners using the above listed script. I got two suggestions for changes but neither resulting in a working script. Is there a list member that would be willing to send me a small working script using script-fu-round-corners so I can learn how to use it. Thank you very much. John ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-round-corners
Hi List, I thought I might tie off this thread by indicating that I now have a working script. It appears the definition for script-fu-round-corners in script-fu console is in error in that the run-mode variable indicated is not reflected in the definition of the script. I removed the RUN-NONINTERACTIVE from my script and I was off and running. Here is the final script: I beleive Saul Goode already indicated this is not an error. The calls in the PDB and are correct when calling from a plugin (C or Python). My understanding is that scheme scripts get their functions wrapped in a PDB wrapper when registered, and can not be called interactively from within scheme. This means you can't call the registered PDB function, but instead have to call the scheme script declaration that was registered. If you look in the file selection-round.scm you wil see the declaration: (define (script-fu-selection-rounded-rectangle image drawable radius concave) ... which is what must be called to access this from within scheme. When this is registered in the PDB with the following call: (script-fu-register script-fu-selection-rounded-rectangle _Rounded R_ectangle... _Round the corners of the current selection Alan Horkan, Sven Neumann ; authors Sven Neumann ; copyright 2004/06/07 * SF-IMAGE Image 0 SF-DRAWABLEDrawable 0 SF-ADJUSTMENT _Radius (%) '(50 0 100 1 10 0 0) SF-TOGGLE _ConcaveFALSE ) It ends up existing with the additional run-mode parameter in front. -Rob A ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
2010/6/6 Dillon dillonontheco...@gmail.com: Someone off-list suggested ImageMagick. Some googling shows this command: convert mulitple.tif single%d.tif I think this will create multiple files, each representing a page from the tif. Since I planned on wrapping all my script-fu in PowerShell, I could insert a call to imagemagick to create a temp folder of split-up TIFs, which my script-fu could convert to XCF. I'd rather do the whole thing in script-fu, as I anticipate doing some filtering and stuff via GIMP. If I start down the ImageMagick route, I may just go with a PowerShell/ImageMagick approach and leave out the script-fu. Any strong suggestions on going one way or the other? I'll still do all my manual editing in GIMP, but maybe not any of the batch work ... I personally don't think there's much of an advantage using Script-Fu as opposed to ImageMagick when it comes to batch processing. ImageMagick is widely used in all kinds of applications. It also has an abundance of filtering capabilities that you can easily use. That being said, I'm neither an ImageMagick wizard nor a Script-Fu/GIMP one. -- Deniz Dogan ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
That's the conclusion I came to as well. I am still figuring out how to do raw CR2 files, but the script below does handle multi-page TIFFs just fine. It's a PowerShell (Windows) wrapper around ImageMagick. Not elegant, and the formatting on blogger kinda sucks (I'll fix that someday), but here it is: http://disassemblyrequired.blogspot.com/2010/06/powershell-and-imagemagick.html http://disassemblyrequired.blogspot.com/2010/06/powershell-and-imagemagick.htmlThe magick all happens with this single command: - convert image[0].tif image.xcf Nice. On Mon, Jun 7, 2010 at 4:40 AM, Deniz Dogan deniz.a.m.do...@gmail.comwrote: 2010/6/6 Dillon dillonontheco...@gmail.com: Someone off-list suggested ImageMagick. Some googling shows this command: convert mulitple.tif single%d.tif I think this will create multiple files, each representing a page from the tif. Since I planned on wrapping all my script-fu in PowerShell, I could insert a call to imagemagick to create a temp folder of split-up TIFs, which my script-fu could convert to XCF. I'd rather do the whole thing in script-fu, as I anticipate doing some filtering and stuff via GIMP. If I start down the ImageMagick route, I may just go with a PowerShell/ImageMagick approach and leave out the script-fu. Any strong suggestions on going one way or the other? I'll still do all my manual editing in GIMP, but maybe not any of the batch work ... I personally don't think there's much of an advantage using Script-Fu as opposed to ImageMagick when it comes to batch processing. ImageMagick is widely used in all kinds of applications. It also has an abundance of filtering capabilities that you can easily use. That being said, I'm neither an ImageMagick wizard nor a Script-Fu/GIMP one. -- Deniz Dogan ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu for batch image conversion
Hello folks, I am trying to perform batch conversions of images, including scanned tifs (multi-page), JPGs, and .CR2 raw files. My workflow is as follows: 1) scan/acquire raw images to disk 2) batch convert to XCF 3) hand-edit selected XCFs 4) batch convert to flattened JPG/PNG/etc I am working on a script-fu function for #2, but I'm seeing some odd behavior. When I run the script against JPGs, it creates an XCF for each JPG, but all of the XCFs have the content of the first JPG. I assume I have a scoping problem, or the image variables need to be deleted with each iteration of the while loop, but I'm not having any luck. My second issue is, when I run the script against my scanned 16-bit multi-page TIFs, I get a batch execution failure when calling gimp-image flatten. I haven't started working on the CR2 files yet. Here is the code I'm using: ; START SCRIPT FU (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) (gimp-message-set-handler 2) (gimp-message Preparing to act on the following files) (gimp-message pattern) (while (pair? filelist) ; set filename to the name of the current file in the glob (set! filename (car filelist)) (gimp-message The current file is: ) (gimp-message filename) ; set xcfname by tokenizing on . and taking everything but the last part (set! fileparts (strbreakup filename .)) (set! fileparts (butlast fileparts)) (set! xcfname (string-append (unbreakupstr fileparts .) .xcf)) (gimp-message The new filename will be: ) (gimp-message xcfname) ; set image from the file, and then get the first layer and set it to newimage (gimp-message Loading File.) (set! image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (set! newimage (car (gimp-image-get-layers image))) ; set drawable to the newimage (gimp-message Setting the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) (set! filelist (cdr filelist)) ) ) ) ; END SCRIPT FU When I execute it like this: c:\testgimp-2.6 -i -b (batch-save-as-xcf \c:\\test\\*.tif\) -b (gimp-quit 0) I get this output: script-fu.exe-Warning: Preparing to act on the following files script-fu.exe-Warning: c:\test\*.tif script-fu.exe-Warning: The current file is: script-fu.exe-Warning: c:\test\ArroyoSanJose-014.tif script-fu.exe-Warning: The new filename will be: script-fu.exe-Warning: c:\test\ArroyoSanJose-014.xcf script-fu.exe-Warning: Loading File. TIFF image-Warning: Warning: The image you are loading has 16 bits per channel. GIMP can only handle 8 bit, s o it will be converted for you. Information will be lost because of this convers ion. script-fu.exe-Warning: Setting the Drawable. GIMP-Error: Calling error for procedure 'gimp-image-flatten': Procedure 'gimp-image-flatten' has been called with an invalid ID for argument ' image'. Most likely a plug-in is trying to work on an image that doesn't exist a ny longer. batch command experienced an execution error (Type any character to close this window) When I execute it like this: c:\testgimp-2.6 -i -b (batch-save-as-xcf \c:\\test\\*.jpg\) -b (gimp-quit 0) I get this output: script-fu.exe-Warning: Preparing to act on the following files script-fu.exe-Warning: c:\test\*.jpg script-fu.exe-Warning: The current file is: script-fu.exe-Warning: c:\test\019-Arroyo.jpg script-fu.exe-Warning: The new filename will be: script-fu.exe-Warning: c:\test\019-Arroyo.xcf script-fu.exe-Warning: Loading File. script-fu.exe-Warning: Setting the Drawable. script-fu.exe-Warning: Saving the new file. script-fu.exe-Warning: The current file is: script-fu.exe-Warning: c:\test\022-Sunset.jpg script-fu.exe-Warning: The new filename will be: script-fu.exe-Warning: c:\test\022-Sunset.xcf script-fu.exe-Warning: Loading File. script-fu.exe-Warning: Setting the Drawable. script-fu.exe-Warning: Saving the new file. script-fu.exe-Warning: The current file is: script-fu.exe-Warning: c:\test\024-Sunset.jpg script-fu.exe-Warning: The new filename will be: script-fu.exe-Warning: c:\test\024-Sunset.xcf script-fu.exe-Warning: Loading File. script-fu.exe-Warning: Setting the Drawable. script-fu.exe-Warning: Saving the new file. batch command executed successfully (Type any character to close this window) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Quoting Dillon dillonontheco...@gmail.com: I am trying to perform batch conversions of images, including scanned tifs (multi-page), JPGs, and .CR2 raw files. My workflow is as follows: 1) scan/acquire raw images to disk 2) batch convert to XCF 3) hand-edit selected XCFs 4) batch convert to flattened JPG/PNG/etc I am working on a script-fu function for #2, but I'm seeing some odd behavior. ... ... (set! image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (set! newimage (car (gimp-image-get-layers image))) Substitute 'newimage' for 'image' in the first line, and remove the second line. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Thanks Saulgoode, that worked! It solved both of my problems. Interesting. I'll have to puzzle through why it worked later, but now I'm on to my next challenge. The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. Here's the script, as it's currently written (ignore the commented out lines - I don't have any version control available to me, so this file is full of notes): (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) (gimp-message-set-handler 2) (gimp-message Preparing to act on the following files) (gimp-message pattern) (while (pair? filelist) ; set filename to the name of the current file in the glob (set! filename (car filelist)) (gimp-message The current file is: ) (gimp-message filename) ; set xcfname by tokenizing on . and taking everything but the last part (set! fileparts (strbreakup filename .)) (set! fileparts (butlast fileparts)) (set! xcfname (string-append (unbreakupstr fileparts .) .xcf)) (gimp-message The new filename will be: ) (gimp-message xcfname) ; set image from the file, and then get the first layer and set it to newimage (gimp-message Loading File.) (set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) ;(set! image (car (file-tiff-load RUN-NONINTERACTIVE filename filename))) ;(set! newimage (car (gimp-image-get-layers image))) ; set drawable to the newimage (gimp-message Setting the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) ;(gimp-image-delete image) ;(gimp-image-delete newimage) (set! filelist (cdr filelist)) ) ) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
2010/6/6 Dillon dillonontheco...@gmail.com: Thanks Saulgoode, that worked! It solved both of my problems. Interesting. I'll have to puzzle through why it worked later, but now I'm on to my next challenge. The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. I haven't tried this myself, but maybe ImageMagick (the `convert' application) supports that already? Just an idea! -- Deniz Dogan ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Someone off-list suggested ImageMagick. Some googling shows this command: convert mulitple.tif single%d.tif I think this will create multiple files, each representing a page from the tif. Since I planned on wrapping all my script-fu in PowerShell, I could insert a call to imagemagick to create a temp folder of split-up TIFs, which my script-fu could convert to XCF. I'd rather do the whole thing in script-fu, as I anticipate doing some filtering and stuff via GIMP. If I start down the ImageMagick route, I may just go with a PowerShell/ImageMagick approach and leave out the script-fu. Any strong suggestions on going one way or the other? I'll still do all my manual editing in GIMP, but maybe not any of the batch work ... On Sun, Jun 6, 2010 at 11:03 AM, Dillon dillonontheco...@gmail.com wrote: Thanks Saulgoode, that worked! It solved both of my problems. Interesting. I'll have to puzzle through why it worked later, but now I'm on to my next challenge. The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. Here's the script, as it's currently written (ignore the commented out lines - I don't have any version control available to me, so this file is full of notes): (define (batch-save-as-xcf pattern) (let* ( (filelist (cadr (file-glob pattern 1))) (fileparts) (xcfname) (filename) (image) (newimage) (drawable) ) (gimp-message-set-handler 2) (gimp-message Preparing to act on the following files) (gimp-message pattern) (while (pair? filelist) ; set filename to the name of the current file in the glob (set! filename (car filelist)) (gimp-message The current file is: ) (gimp-message filename) ; set xcfname by tokenizing on . and taking everything but the last part (set! fileparts (strbreakup filename .)) (set! fileparts (butlast fileparts)) (set! xcfname (string-append (unbreakupstr fileparts .) .xcf)) (gimp-message The new filename will be: ) (gimp-message xcfname) ; set image from the file, and then get the first layer and set it to newimage (gimp-message Loading File.) (set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) ;(set! image (car (file-tiff-load RUN-NONINTERACTIVE filename filename))) ;(set! newimage (car (gimp-image-get-layers image))) ; set drawable to the newimage (gimp-message Setting the Drawable.) (set! drawable (car (gimp-image-flatten newimage))) ; save the drawable from newimage as xcfname (gimp-message Saving the new file.) (gimp-file-save RUN-NONINTERACTIVE newimage drawable xcfname xcfname) ;(gimp-image-delete image) ;(gimp-image-delete newimage) (set! filelist (cdr filelist)) ) ) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu for batch image conversion
Quoting Dillon dillonontheco...@gmail.com: The reason I'm writing my own script-fu, rather than using Daves Batch Processor, is that my TIF files are multi-page, and when I load the image and flatten it to a drawable, I end up with both pages flattened into one drawable. I only want one of the pages (I think the first). I need to find a way to select that page (which I assume is turned into a layer when the TIF is loaded), and just set that layer to be my drawable. In that case, you were on the right track originally with using 'gimp-image-get-layers' (I am also assuming multi-page TIFFs load as separate layers). However, you had incorrectly handled the value returned by the function. 'gimp-image-get-layers' returns returns a list containing two elements: the number of layers in the image and an array of the layerIDs of those layers: (set! num-layers (car (gimp-image-get-layers image))) (set! layerIDs (cadr (gimp-image-get-layers image))) You can obtain the layerID of the top layer with: (set! top-layer (vector-ref layerIDs 0)) The next down with: (set! next-layer (vector-ref layerIDs 1)) And so on: (set! bottom-layer (vector-ref layerIDs (- num-layers 1))) If you know the position of the layer you wish to keep (the TIFF page), you can then remove all of the other layers from the image with: (set! pos 0) (while ( pos num-layers) (unless (= pos TIFFpage) (gimp-image-remove-layer image (vector-ref layerIDs pos)) ) (set! i (+ i 1)) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu Exceptions and errors
Thomas DuBuisson (thomas.dubuis...@gmail.com) wrote: - CODE -- (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image))) ) (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-mode layer1 25) ) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image ... - END CODE -- As you already found out, flattening the image makes its layers invalid, this is because it generates a new one, which it returns as result. As you can see in my re-indented version of your code, you use let* to bind the newly created layer to the layer1 variable, yet you forget it too early, since you need to use it for the gimp-layer-new-from-drawable. I don't like how you nest the various let*-statements. That makes the code hard to track. It would be better if you have some dummy variable declarations in your outer let*-statement and then use set! to redefine the values. Something like this: (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image))) (layer1 0) ) (set! layer0 (car (gimp-image-flatten image))) (gimp-layer-set-mode layer0 25) (set! layer1 (car (gimp-layer-new-from-drawable layer0 image))) ... Also note that the use of 25 for the mode is not nice, you really should use the symbolic constants. 3) C Assertation failures Perhaps most concerning are the assertation failures. Presumably, these are not supposed to happen. How concerned should I be? [...] (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed You should be concerned moderately, since your code apparently is doing some bogus stuff and does not properly keep track of the layers in the image. However, the critical warning should not happen, we really should catch these errors in the PDB wrappers already. Hope this helps, Simon -- si...@budig.de http://simon.budig.de/ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu Exceptions and errors
I don't like how you nest the various let*-statements. That makes the code hard to track. It would be better if you have some dummy variable declarations in your outer let*-statement and then use set! to redefine the values. Also note that the use of 25 for the mode is not nice, you really should use the symbolic constants. These issues are because my code is randomly generated using a Script-fu syntax tree I wrote. I'll add indentation to the AST/Script-fu compiler and that should make things easier to read. Not sure how to handle the side-effects of flattening, I'll think on it more. You should be concerned moderately, since your code apparently is doing some bogus stuff and does not properly keep track of the layers in the image. However, the critical warning should not happen, we really should catch these errors in the PDB wrappers already. It's a little more concerning to me that I found 1 infinite loop that nearly crashed my system (took a while to register, but I finally killed gimp-console) and several memory bugs where a gimp plugin requests gigabytes of memory (and then fails). Also, values aren't garbage collected after fails scripts thus my constant testing lead to a gimp-console taking nearly all of my 4GB of RAM; this forced me to stop using GIMP for the project. After I finish with this project I'd be happy to re-generate some of the buggy scripts and post to the developers list if you'd like - somewhat like BNF fuzzing script-fu :-) Thanks Simon, Thomas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu Exceptions and errors
Hello list, I am planning on evolving image transformations using an AST of the script-fu langauge and generating random (but syntatically correct) scripts. I would like to avoid programming in hundreds of corner cases into the system and thus have the following questions: 1) Script-fu throws exceptions If/when I do something basic like call gimp-image-raise-layer on a layer that can not be raised, an exception is thrown. I would very much like to catch/ignore exceptions such as this but it seems script-fu is too primitive. Am I missing something? 2) gimp-layer-new-from-drawable nearly always fails - CODE -- (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-mode layer1 25) ) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image ... - END CODE -- In the above you see I define layer0 as the active layer (which I thought was a drawable) but this doesn't work for gimp-layer-new-from-drawable. Replacing layer0 with 'image' also doesn't work and most frustratingly, using (gimp-image-get-active-drawable image) also doesn't work - which I really thought it should based on the documentation. What does this function expect? (I understand gimp-image-flatten somehow screws everything up by eliminating the layer, but am still not clear how to once-again get a valid layer from my image) 3) C Assertation failures Perhaps most concerning are the assertation failures. Presumably, these are not supposed to happen. How concerned should I be? START CONSOLE DUMP - (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-add-alpha layer1) (gimp-image-merge-down image layer1 2)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-opacity layer1 21.811554) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-flatten layer1) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((currDraw (car (gimp-image-get-active-layer image (gimp-file-save RUN-NONINTERACTIVE image currDraw newImage.png newImage.png )) ) (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed END CONSOLE DUMP - Cheers, Thomas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu Exceptions and errors
Update: 1) The question regarding exceptions remains - there are too many corner cases, mostly undocumented, so it would be nice to ignore them silently. 2) I see my fix was almost right but I forgot to take the head of the list: (car (gimp-image-get-active-drawable image)) is what I want, not the no-longer-existing layer0 or the whole list returned by gimp-image-get-active-{layer,drawable}. 3) I still get things like the message below, so same question. (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed On Tue, Nov 24, 2009 at 10:05 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Hello list, I am planning on evolving image transformations using an AST of the script-fu langauge and generating random (but syntatically correct) scripts. I would like to avoid programming in hundreds of corner cases into the system and thus have the following questions: 1) Script-fu throws exceptions If/when I do something basic like call gimp-image-raise-layer on a layer that can not be raised, an exception is thrown. I would very much like to catch/ignore exceptions such as this but it seems script-fu is too primitive. Am I missing something? 2) gimp-layer-new-from-drawable nearly always fails - CODE -- (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-mode layer1 25) ) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image ... - END CODE -- In the above you see I define layer0 as the active layer (which I thought was a drawable) but this doesn't work for gimp-layer-new-from-drawable. Replacing layer0 with 'image' also doesn't work and most frustratingly, using (gimp-image-get-active-drawable image) also doesn't work - which I really thought it should based on the documentation. What does this function expect? (I understand gimp-image-flatten somehow screws everything up by eliminating the layer, but am still not clear how to once-again get a valid layer from my image) 3) C Assertation failures Perhaps most concerning are the assertation failures. Presumably, these are not supposed to happen. How concerned should I be? START CONSOLE DUMP - (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-add-alpha layer1) (gimp-image-merge-down image layer1 2)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-opacity layer1 21.811554) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-flatten layer1) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((currDraw (car (gimp-image-get-active-layer image (gimp-file-save RUN-NONINTERACTIVE image currDraw newImage.png newImage.png )) ) (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed END CONSOLE DUMP - Cheers, Thomas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu Exceptions and errors
Update 2: 1) Exceptions The macro (not sure of the underlying primitives) catch will catch errors. The web page didn't even call them exceptions, which explains why I/google didn't find it quickly. Ex: when converting an image that might already be RGB to RGB: (catch (gimp-image-convert-rgb image)) 2) The layer issue As stated before, an earlier command was obliterating my layer and I forgot to take the head of the get-active-{layer,drawable} in my later operations. 3) Assertation failures and segfaults The assertation failures are probably somehow connected with my layer merging - not that it is good to be able to hit this so easily. I also found a segfault, do to out of range arguments, since my previous post and see that this doesn't crash the program - so its running in a different thread or processs I guess. Not sure if I can catch this with catch, if I can't then I'll have to fix these corner cases. Perhaps I'll make some patches for the function documentation if people are interested. Thomas On Tue, Nov 24, 2009 at 11:34 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Update: 1) The question regarding exceptions remains - there are too many corner cases, mostly undocumented, so it would be nice to ignore them silently. 2) I see my fix was almost right but I forgot to take the head of the list: (car (gimp-image-get-active-drawable image)) is what I want, not the no-longer-existing layer0 or the whole list returned by gimp-image-get-active-{layer,drawable}. 3) I still get things like the message below, so same question. (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed On Tue, Nov 24, 2009 at 10:05 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Hello list, I am planning on evolving image transformations using an AST of the script-fu langauge and generating random (but syntatically correct) scripts. I would like to avoid programming in hundreds of corner cases into the system and thus have the following questions: 1) Script-fu throws exceptions If/when I do something basic like call gimp-image-raise-layer on a layer that can not be raised, an exception is thrown. I would very much like to catch/ignore exceptions such as this but it seems script-fu is too primitive. Am I missing something? 2) gimp-layer-new-from-drawable nearly always fails - CODE -- (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-mode layer1 25) ) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image ... - END CODE -- In the above you see I define layer0 as the active layer (which I thought was a drawable) but this doesn't work for gimp-layer-new-from-drawable. Replacing layer0 with 'image' also doesn't work and most frustratingly, using (gimp-image-get-active-drawable image) also doesn't work - which I really thought it should based on the documentation. What does this function expect? (I understand gimp-image-flatten somehow screws everything up by eliminating the layer, but am still not clear how to once-again get a valid layer from my image) 3) C Assertation failures Perhaps most concerning are the assertation failures. Presumably, these are not supposed to happen. How concerned should I be? START CONSOLE DUMP - (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE image.png image.png))) (layer0 (car (gimp-image-get-active-layer image (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-add-alpha layer1) (gimp-image-merge-down image layer1 2)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-image-flatten image (gimp-layer-set-opacity layer1 21.811554) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image (gimp-layer-flatten layer1) (gimp-image-merge-down image layer1 0)) (set! layer0 (gimp-image-get-active-layer image)) (let* ((currDraw (car (gimp-image-get-active-layer image (gimp-file-save RUN-NONINTERACTIVE image currDraw newImage.png newImage.png )) ) (gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer: assertion `gimp_container_have (image-layers, GIMP_OBJECT (layer))' failed END CONSOLE DUMP - Cheers, Thomas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu vs GIMP UI
On 2009-09-15, jolie S for...@gimpusers.com wrote: ??? Obviously, the same as when I click repeatedly along the path... Imagine select color with add to selection and small threshold... E.g., select colors close to any one in the path. You say you want to select a color close to any one in the path, but a path isn't a color. ??? Still, points on path have colors. (Was it in vs on which made this so hard to understand?) All I can think of is if when you stroke a path with say the foreground colour you get a line of that color where the path is. Wrong. Try it with different brushes... So if you would stroke the path with a selection tool you would just select the path, so why not just use path to selection. ??? Are you under impression that a selection tool selects the point you click on? Or what? [I specially mentioned color selection tool.] Yours, Ilya ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu vs GIMP UI
Hi, On Sun, 2009-09-13 at 23:42 +, Ilya Zakharevich wrote: I am afraid there is no way to do this for tools like 'color select' or 'magic wand'. Tools are a user interface thing and the PDB explicitly doesn't give access to the user interface parts of GIMP. This sentence does not make any sense to me. To make sense, one should have a PRIOR definition of the user interface parts of GIMP. E.g., from what you write, It looks like foreground color is not in the user interface parts of GIMP. The foreground color is part of the context, which is not part of the user interface. The user interface just controls the user context. The fact that script-fu, or rather the PDB, allows to change things in the user context, such as the foreground or background color, is actually a misconception that was made early in the GIMP development. We tried later to correct this by introducing script-specific contexts. But since we didn't want to break existing scripts, we had to introduce 'gimp-context-push' and 'gimp-context-pop'. All scripts that wish to change the context are supposed to use these, so that they get their own context. This way the user context (which is what the GIMP user interface uses), is not affected by scripts. So. is there such a definition? Is it defined as any setting outside those related to save/restore-state Script-Fu API, or is there anything else accessible from Script-Fu? The code in app makes a very clear distinction between the core and the user interface. If you want to understand the details, please have a look at the code. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu vs GIMP UI
On 2009-09-14, Jolie S for...@gimpusers.com wrote: What kind of outcome are you expecting to get when stroking a path with a selection tool? ??? Obviously, the same as when I click repeatedly along the path... Imagine select color with add to selection and small threshold... I can't think of why you want to do this? Maybe someone can help you if we know what it is that you are trying to accomplish. E.g., select colors close to any one in the path. Thanks, Ilya ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu vs GIMP UI
On 2009-09-13, Sven Neumann s...@gimp.org wrote: I want to stroke the path with the current tool, with all the parameters as selected in the tool options. I do not think I can do it with the PATHs right-mouse-click menu, can I? (What I see are only choices of Paint tools. What I want is Select tools, like color select and/or magic wand.) You can't do that. Is it a defect, or an intentional decision? An alternative would be to use Script-Fu API to walk along a path; but I would need to invoke the current tool at the specified point from Script-Fu, and I can't guess how to find this with the Script-Fu procedure browser... I am afraid there is no way to do this for tools like 'color select' or 'magic wand'. Tools are a user interface thing and the PDB explicitly doesn't give access to the user interface parts of GIMP. This sentence does not make any sense to me. To make sense, one should have a PRIOR definition of the user interface parts of GIMP. E.g., from what you write, It looks like foreground color is not in the user interface parts of GIMP. So. is there such a definition? Is it defined as any setting outside those related to save/restore-state Script-Fu API, or is there anything else accessible from Script-Fu? Thanks, Ilya ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu vs GIMP UI
What kind of outcome are you expecting to get when stroking a path with a selection tool? I can't think of why you want to do this? Maybe someone can help you if we know what it is that you are trying to accomplish. -- jolie (via www.gimpusers.com) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script fu may call Gegl operation ?
Hi, On Wed, 2009-09-09 at 06:33 +0200, photocomix wrote: Something as duplicate layer Apply Gegl operation/c2g on the dup Change layer mode of dup in Value will be possible with script fu ? Not yet, but it is a nice idea. Someone would have to make up a patch that allows to call a GEGL operation (with all its parameters) over the PDB. Not trivial, but certainly doable. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script fu may call Gegl operation ?
Something as duplicate layer Apply Gegl operation/c2g on the dup Change layer mode of dup in Value will be possible with script fu ? From the default of gegl operation /c2g i will need only to change the setting for samples (from 3 to 6 or more ) would be possible ? -- photocomix (via www.gimpusers.com) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu rand function
Kevin Cozens wrote: If you want to change the seed each time you start GIMP, add '(srand (realtime))' before you call '(rand)'. Thanks. That solved my problem. -- Catherine ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu rand function
Hello, When I use the rand function in a script-fu script that I run non-interactively from the command line, I get the exact same result every time. In other words, the command gimp -i -b '(script-name var 1 var2 ...)' -b '(gimp-quit 0)' always does the same thing (assuming the same variable inputs). This is not the behavior I want. I'd like to be able to re-seed the random number generator so as to get randomly different results. Is this possible with script-fu? Thanks... Catherine ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu for multi-language
See also the gettext package documentation for increase your knowledge on the subject. Thanks a lot :) I'll see about it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu for multi-language
Quoting Tetsuya Yuasa w...@ironsand.net: I've writed some script-fu and I want to know how can I rewrite it for multi-language, exactly said, for two-language. Of course I can write it by separated files, but it bothered me when I need to rewrite the script. Is there any document about it? There are probably people better qualified to answer your questions, and I may even be giving bad advice; however, my understanding is that you should mark strings in your script which you want translated with an underscore. _this text should be translated Such text strings will then be handled, not by GIMP itself, but by GLIB based on the user's LOCALE setting. Of course, a translated substitute must be provided and that should be coordinated with the translation team for the language which you wish to have supported. A list of the translation teams for various languages is available at http://l10n.gnome.org/teams/ . If you contact the appropriate team for your language, they should be able to provide much better guidance. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu for multi-language
A list of the translation teams for various languages is available at http://l10n.gnome.org/teams/ . If you contact the appropriate team for your language, they should be able to provide much better guidance. Thanks for your help! Your advise helped me so much. :) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu for multi-language
On Fri, Feb 27, 2009 at 07:58:32PM +0100, Tetsuya Yuasa wrote: A list of the translation teams for various languages is available at http://l10n.gnome.org/teams/ . If you contact the appropriate team for your language, they should be able to provide much better guidance. Thanks for your help! Your advise helped me so much. :) See also the gettext package documentation for increase your knowledge on the subject. bye -- Marco Ciampa ++ | Linux User #78271 | | FSFE fellow #364 | ++ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu for multi-language
Hi, I've writed some script-fu and I want to know how can I rewrite it for multi-language, exactly said, for two-language. Of course I can write it by separated files, but it bothered me when I need to rewrite the script. Is there any document about it? I would appreciate any your help. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Le Wed, 18 Feb 2009 12:33:36 -0500 saulgo...@flashingtwelve.brickfilms.com écrivait: You still can (and will) use 'set!' in your scripts; but you need to create the variable first. Previously, the variable would be created automatically if it did not exist. Allright, thanks for the information. -- Frantz http://librephoto.net/ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Quoting Claus Cyrny claus.cy...@web.de: I'm currently trying to write a Script-Fu (actually my first one), but although I found several online tutorials on how to go about, I'm still not sure of the proper syntax for most of the steps I would like the script to perform. I've included an attachment (plain text) which contains some of code fragments which correspond with the steps you described (your steps are the lines starting with ;- ). I left out the standard stuff such as registering your script, declaring your variables, and handling UNDO. tmp.scm Description: Lotus Screencam ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Le Wed, 18 Feb 2009 06:51:44 -0500 saulgo...@flashingtwelve.brickfilms.com écrivait: Quoting Claus Cyrny claus.cy...@web.de: I'm currently trying to write a Script-Fu (actually my first one), but although I found several online tutorials on how to go about, I'm still not sure of the proper syntax for most of the steps I would like the script to perform. I've included an attachment (plain text) which contains some of code fragments which correspond with the steps you described (your steps are the lines starting with ;- ). I left out the standard stuff such as registering your script, declaring your variables, and handling UNDO. Hello, I'm new with scripts-fu too. I've had an eye to your script and I saw a lot of (set! . I thought that it doesn't work any more with TinyScheme. (cf. http://www.gimp.org/docs/script-fu-update.html) Regards. -- Frantz http://librephoto.net/ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
The code I attached to my previous post had a mistake on line #24 which should have been: (set! layer (car (gimp-image-get-active-layer value-image))) I also should have used 'hue-image' and 'sat-image' when I later called 'plug-in-compose' (the code I had functioned fine, it just might be a little confusing). Quoting Frantz de Germain fra...@info.univ-angers.fr: I'm new with scripts-fu too. I've had an eye to your script and I saw a lot of (set! . I thought that it doesn't work any more with TinyScheme. (cf. http://www.gimp.org/docs/script-fu-update.html) You still can (and will) use 'set!' in your scripts; but you need to create the variable first. Previously, the variable would be created automatically if it did not exist. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Hi Saul, saulgo...@flashingtwelve.brickfilms.com wrote: The code I attached to my previous post had a mistake on line #24 which should have been: (set! layer (car (gimp-image-get-active-layer value-image))) I also should have used 'hue-image' and 'sat-image' when I later called 'plug-in-compose' (the code I had functioned fine, it just might be a little confusing). thanks a lot for the code you attached, and many thanks to the others who responded! Greetings, Claus -- .:: Claus Cyrny - Webdesign | Grafik | Fotografie ::. :: Website: http://home.arcor.de/ccyrny/ ::. :: Fotos: http://photo.net/photodb/slideshow?folder_id=714471 ::. :: MySpace: http://www.myspace.com/claus_01 ::. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
I did not properly present the part about pasting the recomposed image back into the original layer. You will want to set the offsets of the pasted layer so that they match the original active layer ('drawable') and to also anchor your pasted layer. The code should be similar to the following: (set! floating-sel (car (gimp-edit-named-paste drawable buffer-name TRUE))) (gimp-layer-set-offsets floating-sel (car (gimp-drawable-offsets drawable)) (cadr (gimp-drawable-offsets drawable))) (gimp-floating-sel-anchor floating-sel) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu
Hi, I'm currently trying to write a Script-Fu (actually my first one), but although I found several online tutorials on how to go about, I'm still not sure of the proper syntax for most of the steps I would like the script to perform. This is basically an advanced 'Unsharp Mask' I have been doing manually so far, but since I need it very often, would like to make a Script-Fu for this. The steps are: - Decompose the original RGB image to HSV - Select the V layer - Copy the V layer into a mask - Select merely the mask - Perform 'Find Edges (Sobel)' (value: 2.5) on the mask - Perform 'Gaussian Blur' (value: 2) on the mask - Make a selection from the mask - Delete the mask - Select the V layer with the selection - Perform 'Unsharp Mask' (value depends upon the image) - Compose the image back to RGB TIA, Claus -- .:: Claus Cyrny - Webdesign | Grafik | Fotografie ::. :: Website: http://home.arcor.de/ccyrny/ ::. :: Fotos: http://photo.net/photodb/slideshow?folder_id=714471 ::. :: MySpace: http://www.myspace.com/claus_01 ::. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Hello! On Wed, Feb 18, 2009 at 2:19 PM, Claus Cyrny claus.cy...@web.de wrote: Hi, I'm currently trying to write a Script-Fu (actually my first one), but although I found several online tutorials on how to go about, I'm still not sure of the proper syntax for most of the steps I would like the script to perform. This is basically an advanced 'Unsharp Mask' I have been doing manually so far, but since I need it very often, would like to make a Script-Fu for this. There are other scripting language interfaces available. Python (which I prefer myself), Perl, Ruby, and Lua scripting are all available, Python is more standardized than the others. If you have experience with one of those, I suggest to use that language instead. Personally I think almost any language other than Script-fu is a better choice. I've got quite a wide range of experience with different programming languages myself, but when I try to work with Script-fu/Scheme/LISP, writing anything but the very simplest of procedures invokes great frustration in me. David ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu changes?
Hello people. I wrote - quite a while ago - a script to make thumbnails, and modified it for 2.4.x. When I tried to run it in GIMP 2.6.3, it did work correctly, but the screen doesn't update as it should. When the image is scaled, the background doesn't clear, and the scaled image is shown in the upper left corner. The background isn't 'real', meaning it doesn't update when something is moved over. Difficult to put in words. An example is shown here: http://www.jcoppens.com/misc/tests/GIMP.jpg The 'hole' in the middle is where the script dialog was. Is there some extra 'cleanup' necessary in the latest versions? John ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu code to load pdf with set resolution
Hi, On Wed, 2008-10-22 at 01:40 +0200, Ash C. wrote: I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg. When I open the pdf document manually (via the GUI). I am greeted with the Import from PDF window, which allows me to set the resolution of the image which then alters the width and height of the image based on the resolution specified. However, when I attempt to automate this with script-fu, I am having issues getting the same functionality. I am using the 'file-pdf-load' function to load the pdf, however there is no option to set the resolution and height of the image. (It appears to default to 100dpi). This functionality is not available to the PDB. We would accept a patch that improves the PDB interface of the PDF import plug-in. But seriously, I don't understand why you would want to use GIMP for this instead of a simple 'pdftoppm -r 300 pdffile | pnmtojpeg jpegfile' Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu code to load pdf with set resolution
I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg. When I open the pdf document manually (via the GUI). I am greeted with the Import from PDF window, which allows me to set the resolution of the image which then alters the width and height of the image based on the resolution specified. However, when I attempt to automate this with script-fu, I am having issues getting the same functionality. I am using the 'file-pdf-load' function to load the pdf, however there is no option to set the resolution and height of the image. (It appears to default to 100dpi). I can use the 'gimp-image-set-resolution' function to set the resolution but this doesn't automatically update the width and height of the image. When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to transparent. Is this functionality possible or am I missing something completely? Needless to say I am quite new to script-fu. Thanks. -- Ash C. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu code to load pdf with set resolution
Quoting Ash C. [EMAIL PROTECTED]: I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg. ... When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to transparent. In GIMP terminology, resize refers to changing the size of the canvas. Changing the size of the image is termed scaling. If using 'gimp-image-scale' (instead of 'gimp-image-resize') does not address your difficulty, I will put more consideration into my next response :) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu code to load pdf with set resolution
Quoting Ash C. [EMAIL PROTECTED]: I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg. ... When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to transparent. In GIMP terminology, resize refers to changing the size of the canvas. Changing the size of the image is termed scaling. If using 'gimp-image-scale' (instead of 'gimp-image-resize') does not address your difficulty, I will put more consideration into my next response :) Thanks for the quick response. I've actually messed around a little with scaling the image but it appears to degrade the imagery somewhat. I did the process manually whereby loading the image at 100dpi then scaling to 300dpi and increasing the width and height by 3 also but the resultant image was quite degraded compared to loading the PDF directly at 300dpi with the appropriate width and heights. The interpolation setting appears to make very little difference. -- Ash C. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-save-anim-layers
Hi, On Sat, 2008-10-18 at 21:46 -0400, Alec Burgess wrote: This is explained in the release notes for GIMP 2.6: http://gimp.org/release-notes/gimp-2.6.html Thanks ... I think :-) found the example and perused the linked PDF (section 4.2.2. Binding constructs) with out much if any understanding. I changed: (define (save-layer orig-image layer name) (let* ( (image) (buffer) ) to: (define (save-layer orig-image layer name) (let* ( (this-is-correct 0) (image) (buffer) ) The proper fix would have been to use: (let* ( (image -1) (buffer -1) ) The point is the variables need to be initialized on definition. I have chosen to initialize them to -1 in this example as that is the value that is used for an invalid image or buffer ID in GIMP. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-save-anim-layers
Alec Burgess wrote: Thanks ... I think :-) found the example and perused the linked PDF (section 4.2.2. Binding constructs) with out much if any understanding. I changed: (define (save-layer orig-image layer name) (let* ( (image) (buffer) ) to: (define (save-layer orig-image layer name) (let* ( (this-is-correct 0) (image) (buffer) ) You didn't need to read the linked PDF file. That is there for reference in case someone doubted whether the Scheme interpreter in Script-Fu is doing the right thing regarding the let* blocks. The release notes should have made it perfectly clear as to the problem and its fix. Since it appears the note about Script-Fu isn't clear enough I will think about some changes to the information. In the meantime, Sven has pointed out the needed changes to the script that were referred to in the release notes. -- Cheers! Kevin. http://www.ve3syb.ca/ |What are we going to do today, Borg? Owner of Elecraft K2 #2172 |Same thing we always do, Pinkutus: | Try to assimilate the world! #include disclaimer/favourite | -Pinkutus the Borg ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-save-anim-layers
Alec Burgess wrote: Since we've had all these messages about this ... I thought I'd ask: Shouldn't the so-called fix I made, adding a dummy variable with a value but leaving the remaining two variables (image) and (buffer) uninitialized still have been a syntax error? I was surprised that it in fact actually made the script work. Kevin Cozens wrote: Alec Burgess wrote: Thanks ... I think :-) found the example and perused the linked PDF (section 4.2.2. Binding constructs) with out much if any understanding. I changed: (define (save-layer orig-image layer name) (let* ( (image) (buffer) ) to: (define (save-layer orig-image layer name) (let* ( (this-is-correct 0) (image) (buffer) ) You didn't need to read the linked PDF file. That is there for reference in case someone doubted whether the Scheme interpreter in Script-Fu is doing the right thing regarding the let* blocks. The release notes should have made it perfectly clear as to the problem and its fix. Since it appears the note about Script-Fu isn't clear enough I will think about some changes to the information. In the meantime, Sven has pointed out the needed changes to the script that were referred to in the release notes. -- Regards ... Alec ([EMAIL PROTECTED] WinLiveMess - [EMAIL PROTECTED]) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu-save-anim-layers
Script: http://flashingtwelve.brickfilms.com/GIMP/Scripts/save-anim-layers.scm (apparently by Saul Goode 3/11/2008) This script was mentioned in bugzilla: Bug 556548 – Layer extraction script http://bugzilla.gnome.org/show_bug.cgi?id=556548 Attempts to execute it result in: Error while executing script-fu-save-anim-layers: Error: Bad syntax of binding spec in let* : ((image) (buffer)) I think this is due to changes in script-fu (?) but don't know enough about script-fu to correct it. Could someone help? Also ... in the script comments, its not clear which directory/folder the files will be created? -- Regards ... Alec ([EMAIL PROTECTED] WinLiveMess - [EMAIL PROTECTED]) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-save-anim-layers
Hi, On Sat, 2008-10-18 at 18:19 -0400, Alec Burgess wrote: Error while executing script-fu-save-anim-layers: Error: Bad syntax of binding spec in let* : ((image) (buffer)) I think this is due to changes in script-fu (?) but don't know enough about script-fu to correct it. Could someone help? This is explained in the release notes for GIMP 2.6: http://gimp.org/release-notes/gimp-2.6.html Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-save-anim-layers
Script has been updated. Quoting Alec Burgess [EMAIL PROTECTED]: Script: http://flashingtwelve.brickfilms.com/GIMP/Scripts/save-anim-layers.scm (apparently by Saul Goode 3/11/2008) This script was mentioned in bugzilla: Bug 556548 – Layer extraction script http://bugzilla.gnome.org/show_bug.cgi?id=556548 Attempts to execute it result in: Error while executing script-fu-save-anim-layers: Error: Bad syntax of binding spec in let* : ((image) (buffer)) I think this is due to changes in script-fu (?) but don't know enough about script-fu to correct it. Could someone help? Also ... in the script comments, its not clear which directory/folder the files will be created? -- Regards ... Alec ([EMAIL PROTECTED] WinLiveMess - [EMAIL PROTECTED]) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu plugin
Thank you so much Saul, that works great!!! Date: Wed, 15 Oct 2008 18:15:05 -0400 From: [EMAIL PROTECTED] To: Gimp-user@lists.XCF.Berkeley.EDU Subject: [Gimp-user] Script-fu plugin Quoting Adonj Adonj [EMAIL PROTECTED]: I updated my Gimp program from version 2.4.7 to 2.6.0-i686. The Script-fu plugin copyToAllLayers.scm gave an error, and a Gimp Message: Plug-In 'Copy mask' left image undo in inconsistent state, closing open undogroups. I wondered if you have a correction for the code.Very much appreciated. Sorry for the delay, my Internet has been broken since Saturday. I have updated the script for GIMP 2.6: http://flashingtwelve.brickfilms.com/GIMP/Scripts/copy-masks-26.scm ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script Fu error
This scrip used to work in gimp 2.4.7 but when I try to execute this script 2.6.1 I recieve this message but I am not sure what to change in order to make it work again: Error while executing script-fu-quick-sketch2: Error: eval: unbound variable: script-fu-quick-sketch2 ; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Quick sketch script for GIMP 2.4 ; Copyright (C) 2007 Harry Phillips [EMAIL PROTECTED] ; ; Author statement: ; ; Quick sketch turns a photo into what looks like a artists sketch ; ; ; Distributed by Gimp FX Foundry project ; ; - Changelog - ; Last changed by author: 9 September 2007 ; ; ; ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program. If not, see http://www.gnu.org/licenses/. ; (define (script-fu-quick-sketch theImage theLayer blurType) ;Initiate some variables (let* ( (layerCopy 0) (layerGrey (car (gimp-drawable-is-gray theLayer))) ) ;Start an undo group so the process can be undone with one undo (gimp-image-undo-group-start theImage) ;Rename the layer (gimp-drawable-set-name theLayer Original) ;Select none (gimp-selection-none theImage) ;Change the image Greyscale if it isn't already (if (= layerGrey 0) (gimp-image-convert-grayscale theImage)) (set! layerCopy (car (gimp-layer-copy theLayer 1))) ;Copy the layer (gimp-image-add-layer theImage layerCopy 0) ;Rename the layer (gimp-drawable-set-name layerCopy Dodge layer) ;Invert the layer (gimp-invert layerCopy) ;Change the layers mode (gimp-layer-set-mode layerCopy 16) ;Blur the dodge layer (case blurType ((0) (plug-in-gauss 0 theImage layerCopy 1 1 0)) ((1) (plug-in-mblur 0 theImage layerCopy 0 1 10 2 2)) (else (plug-in-sel-gauss 0 theImage layerCopy 5 50))) ;Finish the undo group for the process (gimp-image-undo-group-end theImage) ;Ensure the updated image is displayed now (gimp-displays-flush) ) ) (script-fu-register script-fu-quick-sketch2 _Image/Script-Fu/Illustration/Quick sketch2... Create a sketch from a photo Harry Phillips Harry Phillips Sep. 9 2007 * SF-IMAGE Image 0 SF-DRAWABLE Drawable 0 SF-OPTION Blur Type '(Gaussian Blur Motion Blur Selective Blur) ) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script Fu error
D.Jones (aka) Capnhud wrote: Error while executing script-fu-quick-sketch2: Error: eval: unbound variable: script-fu-quick-sketch2 here is a 2 at the end (define (script-fu-quick-sketch theImage here is NO 2 at the end (script-fu-register script-fu-quick-sketch2 here is a 2 at the end Andreas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu plugin
Quoting Adonj Adonj [EMAIL PROTECTED]: I updated my Gimp program from version 2.4.7 to 2.6.0-i686. The Script-fu plugin copyToAllLayers.scm gave an error, and a Gimp Message: Plug-In 'Copy mask' left image undo in inconsistent state, closing open undogroups. I wondered if you have a correction for the code.Very much appreciated. Sorry for the delay, my Internet has been broken since Saturday. I have updated the script for GIMP 2.6: http://flashingtwelve.brickfilms.com/GIMP/Scripts/copy-masks-26.scm ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script Fu error
Thanks that did the trick. --- On Wed, 10/15/08, Andreas Waechter [EMAIL PROTECTED] wrote: From: Andreas Waechter [EMAIL PROTECTED] Subject: Re: [Gimp-user] Script Fu error To: [EMAIL PROTECTED] Cc: Gimp Group gimp-user@lists.XCF.Berkeley.EDU Date: Wednesday, October 15, 2008, 3:55 PM D.Jones (aka) Capnhud wrote: Error while executing script-fu-quick-sketch2: Error: eval: unbound variable: script-fu-quick-sketch2 here is a 2 at the end (define (script-fu-quick-sketch theImage here is NO 2 at the end (script-fu-register script-fu-quick-sketch2 here is a 2 at the end Andreas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu plugin
I updated my Gimp program from version 2.4.7 to 2.6.0-i686. The Script-fu plugin copyToAllLayers.scm gave an error, and a Gimp Message: Plug-In 'Copy mask' left image undo in inconsistent state, closing open undogroups. I wondered if you have a correction for the code.Very much appreciated. Quoting Adonj Adonj : I wondered if you knew of a script that would also APPLY the copied layers as you mention. Edit the script to add the following code: (set! layers (visible-layers image))(while (pair? layers)(gimp-layer-remove-mask (car layers) MASK-APPLY)(set! layers (cdr layers))) Just before the line: (gimp-image-remove-layer image source-layer) _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu plugin
Hi, I checked your script a little. I have to admit, that I don't know scheme very much, because I don't like LISP very much (Lots of Irritating Superfluous Parentheses). I rather work with perl-gimp. But there is an error in your script. Scheme has a built-in function cons. Cons needs two arguments. There is only given one: (if (= tmp TRUE) (set! viewable (append viewable (cons (aref all-layers (- i 1)) To make it clearer: The one argument is: aref all-layers (- i 1) I don't know which argument to give as second. It would take me a while to figure it out. One other thing is disturbing: In the register-function isn't given if it is a stand allone script or if it should work on an image. I assumed it should work on an image. To test your script I set: Image/Script-Fu/_Copy mask . May be in special cases, the function aref provides twp arguments for cons, for example if you have sufficient layers and layer masks, but in others it doesn*t. Anyhow the error isn't caught. I am working with LINUX, so you see that the error is OS-Independent. Greetings Bernd [EMAIL PROTECTED] schrieb: Send Gimp-user mailing list submissions to gimp-user@lists.XCF.Berkeley.EDU To subscribe or unsubscribe via the World Wide Web, visit https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of Gimp-user digest... Today's Topics: 1. script-fu plugin (Adonj Adonj) 2. Re: script-fu plugin (peter kostov) 3. Re: Best way to semi-flatten a transparent gif against a background image (Justyn Butler) 4. Script-fu (Adonj Adonj) 5. Re: Best way to semi-flatten a transparent gif against a background image (David Gowers) 6. Re: script-fu plugin ([EMAIL PROTECTED]) 7. Re: Gimp-user Digest, Vol 72, Issue 22 (Mike W) -- Message: 1 Date: Sun, 28 Sep 2008 00:03:52 -0400 From: Adonj Adonj [EMAIL PROTECTED] Subject: [Gimp-user] script-fu plugin To: gimp-user@lists.XCF.Berkeley.EDU gimp-user@lists.xcf.berkeley.edu Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: Error: cons: needs 2 argument(s) I'm not familiar with the script. Could there be a simple solution to that? Here is the script: ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img) (let* ( (all-layers (gimp-image-get-layers img)) (i (car all-layers)) (viewable ()) (tmp FALSE)) (set! all-layers (cadr all-layers)) (while ( i 0) (set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1) (if (= tmp TRUE) (set! viewable (append viewable (cons (aref all-layers (- i 1)) (set! i (- i 1))) viewable)) (let* ( (active-layer (car (gimp-image-get-active-layer image))) (source-layer) (source-mask) (layers) (mask)) (set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image))) (gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1) (begin (set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK))) (gimp-layer-add-mask source-layer source-mask))) (while (car layers) (if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask) (set! layers (cdr layers))) (gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image) (gimp-displays-flush))) (script-fu-register script-fu-copy-mask-to-layers /Script-Fu/_Copy mask Copy the mask from the current layer to all visible layers Saul
Re: [Gimp-user] script-fu plugin
Adonj Adonj wrote: I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: Error: cons: needs 2 argument(s) I'm not familiar with the script. Could there be a simple solution to that? Here is the script: ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img) (let* ( (all-layers (gimp-image-get-layers img)) (i (car all-layers)) (viewable ()) (tmp FALSE)) (set! all-layers (cadr all-layers)) (while ( i 0) (set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1) (if (= tmp TRUE) (set! viewable (append viewable (cons (aref all-layers (- i 1)) (set! i (- i 1))) viewable)) (let* ( (active-layer (car (gimp-image-get-active-layer image))) (source-layer) (source-mask) (layers) (mask)) (set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image))) (gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1) (begin (set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK))) (gimp-layer-add-mask source-layer source-mask))) (while (car layers) (if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask) (set! layers (cdr layers))) (gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image) (gimp-displays-flush))) (script-fu-register script-fu-copy-mask-to-layers /Script-Fu/_Copy mask Copy the mask from the current layer to all visible layers Saul Goode Saul Goode 6/14/2006 SF-IMAGEImage0 SF-DRAWABLE Drawable 0 ) Isn'tthat a script rather a plug-in? If so it should reside in the scripts folder... But this is gust a guess. I am not familiar with script-fu eithe :( Peter _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user -- http://receptibg.com - рецепти, готварство и хранене, менюта, статии, идеи и полезни съвети --- Boryana Peter Kostovi, web design webdevelopment home site: http://bgwebdeveloper.com ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu
You're absolutely right Peter, my mistake, I meant the script folder C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts.That's where it resides.The new script-fu tab does appear correctly in my image window, however the error I described is present when I click on the tab. Adonj _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu plugin
Quoting Adonj Adonj [EMAIL PROTECTED]: I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: Error: cons: needs 2 argument(s) I'm not familiar with the script. Could there be a simple solution to that? I have updated the script, which can be fetched from http://flashingtwelve.brickfilms.com/GIMP/Scripts/copy-mask.scm ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu plugin
Thank you Saul, that worked perfectly! With regards to your message at: http://72.14.205.104/search?q=cache:7GovFRKtKToJ:lists.xcf.berkeley.edu/lists/gimp-user/2007-January/009388.html+plugin+to+copy+mask+to+all+layers+then+applyhl=enct=clnkcd=2gl=ca You say: You can achieve the same result using layer masks. Unfortunately, there is not a simple built-in way of copying a layer mask to multiple layers or of applying a layer mask to multiple layers. There is a script-fu plugin that will do that. I don't know where I got it. It doesn't seem to be in the Gimp's plugin repository. So here it is:. I wondered if you knew of a script that would also APPLY the copied layers as you mention. Thanks, Adonj _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu plugin
Quoting Adonj Adonj [EMAIL PROTECTED]: I wondered if you knew of a script that would also APPLY the copied layers as you mention. Edit the script to add the following code: (set! layers (visible-layers image)) (while (pair? layers) (gimp-layer-remove-mask (car layers) MASK-APPLY) (set! layers (cdr layers))) Just before the line: (gimp-image-remove-layer image source-layer) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-fu plugin
That was terrific, Saul, thanks a lot! Adonj _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu plugin
I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: Error: cons: needs 2 argument(s) I'm not familiar with the script. Could there be a simple solution to that? Here is the script: ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img) (let* ( (all-layers (gimp-image-get-layers img)) (i (car all-layers)) (viewable ()) (tmp FALSE)) (set! all-layers (cadr all-layers)) (while ( i 0) (set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1) (if (= tmp TRUE) (set! viewable (append viewable (cons (aref all-layers (- i 1)) (set! i (- i 1))) viewable)) (let* ( (active-layer (car (gimp-image-get-active-layer image))) (source-layer) (source-mask) (layers) (mask)) (set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image))) (gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1) (begin (set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK))) (gimp-layer-add-mask source-layer source-mask))) (while (car layers) (if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask) (set! layers (cdr layers))) (gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image) (gimp-displays-flush))) (script-fu-register script-fu-copy-mask-to-layers /Script-Fu/_Copy mask Copy the mask from the current layer to all visible layers Saul Goode Saul Goode 6/14/2006 SF-IMAGEImage0 SF-DRAWABLE Drawable 0 ) _ ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu batch file
Hello, I am a newbie to Gimp. I need to execute Gimp scripts from files which do not reside in ~/.gimp/scripts, for instance with the following invocation example: gimp -i -b $PROJECTDIR/my-script.scm -b 'gimp-quit 0) where $PROJECTDIR is the path to the script my-script.scm. I understand that this is not possible for now. Does anyone know if there is any plan for a future release aiming to allow this way to execute batch commands ? Pierre -- Pierre HABRAKEN - mailto:[EMAIL PROTECTED] Tél: 04 76 63 59 94 - Fax: 04 76 51 47 93 ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu batch file
Hi, On Thu, 2008-09-25 at 09:14 +0200, Pierre Habraken wrote: I am a newbie to Gimp. I need to execute Gimp scripts from files which do not reside in ~/.gimp/scripts, for instance with the following invocation example: gimp -i -b $PROJECTDIR/my-script.scm -b 'gimp-quit 0) where $PROJECTDIR is the path to the script my-script.scm. cat $PROJECTDIR/my-script.scm | gimp -i -b - Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
El Saturday 17 May 2008 23:58:17 Kevin Cozens va escriure: Xavier Mas wrote: I need to program some batch actions using Scheme or Perl in GIMP but am not able to see the scripts once they are registered. Scripts are well writed, are example taken from GIMP manual, and I change permissions on the files as they became executables, but still can't see them in the menu. The proper method for registering scripts has changed slightly in the 2.4 version of GIMP. The manual you are looking at might be a bit out of date. Since you said you made the files executable I think you are mixing up differences between Script-Fu scripts and other scripts (and plug-ins) written in other languages. Script-Fu scripts only need to be readable and go in to the ~/.gimp-2.4/scripts directory. All other scripts and plug-ins need to be marked executable and placed in the ~/.gimp-2.4/plug-ins directory. Thank you Kevin, this really was what I've missed, now it works ! -- Xavier Mas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] Script-Fu
I need to program some batch actions using Scheme or Perl in GIMP but am not able to see the scripts once they are registered. Scripts are well writed, are example taken from GIMP manual, and I change permissions on the files as they became executables, but still can't see them in the menu. There is something am missing. Any suggestions? -- Xavier Mas ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals
Thanks for all of your help, Torsten. I got it figured out. Emacs wasn't very pleasant, but it led me to see what I needed to do. I checked the binary representations of the characters at www.fileformat.info and used the two characters they represent to make each one I needed. For anyone who would like to see what it ended up looking like, check out http://pubpages.unh.edu/~jmb97/SDL/NFont/render-nfont.scm Maybe it would have been easier to write a C++ program that outputs a string to a file, since the unicode escape (\u00A1, for example) is really simple. Anyhow, it's done. Thanks again, Jonny D From: [EMAIL PROTECTED] To: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals Date: Fri, 16 May 2008 18:31:20 +0200 CC: [EMAIL PROTECTED] Hi, I tried using Emacs, but changing the encoding didn't affect anything. Just loading the file, changing the encoding and saving it again won't do anything. The encoding switches are meant for newly entered text. That means that you will have to re-enter the characters with the UTF-8 encoding switched on. Torsten _ Give to a good cause with every e-mail. Join the i’m Initiative from Microsoft. http://im.live.com/Messenger/IM/Join/Default.aspx?souce=EML_WL_ GoodCause___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-Fu
Xavier Mas wrote: I need to program some batch actions using Scheme or Perl in GIMP but am not able to see the scripts once they are registered. Scripts are well writed, are example taken from GIMP manual, and I change permissions on the files as they became executables, but still can't see them in the menu. The proper method for registering scripts has changed slightly in the 2.4 version of GIMP. The manual you are looking at might be a bit out of date. Since you said you made the files executable I think you are mixing up differences between Script-Fu scripts and other scripts (and plug-ins) written in other languages. Script-Fu scripts only need to be readable and go in to the ~/.gimp-2.4/scripts directory. All other scripts and plug-ins need to be marked executable and placed in the ~/.gimp-2.4/plug-ins directory. -- Cheers! Kevin. http://www.ve3syb.ca/ |What are we going to do today, Borg? Owner of Elecraft K2 #2172 |Same thing we always do, Pinkutus: | Try to assimilate the world! #include disclaimer/favourite | -Pinkutus the Borg ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals
I'm still not able to get this to work. Attached is my script (or find it at http://pubpages.unh.edu/~jmb97/SDL/NFont/render-nfont.scm). It produces a bitmap of the characters in a font. I thought the whole first byte was identical between ASCII and UTF-8... Anyhow, maybe someone can get it to work or see what I'm trying to do. Basically, I'm just trying to put the special and accented characters (161, '¡' to 255, ÿ) into a string, but the Gimp isn't outputting anything where they should be. The script appears as NFont-Create NFont. Then you must check the extended ASCII box. I tried using Emacs, but changing the encoding didn't affect anything. Thanks, Jonny D From: [EMAIL PROTECTED] To: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals Date: Thu, 15 May 2008 10:46:41 +0200 CC: [EMAIL PROTECTED] Hi, Do you mean just type them in? Yes. That isn't working for me. Wouldn't switching the encoding affect the whole file instead of just a particular string? That should do no harm as Gimp is doing about everything in UTF-8 internally. Plus, any characters that are relevant to Scheme syntax (i.e. not strings) are from 7-bit ASCII and won't be touched anyway when you switch to UTF-8. I'm on WinXP, just using Notepad, which can handle the ascii values I'm using (I was surprised that Dr. Scheme can't, however). Strictly speaking, the values that you are talking about are not ASCII (as that only defines 7 bits originally - the upper 127 characters depend on which locale you are in and might even be text graphics). Notepad also stores its data in an encoding, which however is not UTF-8. Typing them into a string isn't working. Hmm... have you tried using the ALT-numpad-sequence for entering the values ? You seem to know the encoding values of the characters in UTF-8, so this might work then with Notepad. Torsten _ Change the world with e-mail. Join the i’m Initiative from Microsoft. http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ChangeWorld render-nfont.scm Description: Binary data ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals
Hi, I tried using Emacs, but changing the encoding didn't affect anything. Just loading the file, changing the encoding and saving it again won't do anything. The encoding switches are meant for newly entered text. That means that you will have to re-enter the characters with the UTF-8 encoding switched on. Torsten signature.asc Description: This is a digitally signed message part. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals
Hi, just use a proper editor. Emacs is available for free and it supports UTF-8 and syntax highlighting for the Scheme language. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user