Re: [Gimp-user] script-fu-menu-register with space in folder name?

2010-10-31 Thread Alan Campbell
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


Re: [Gimp-user] Script-Fu Illegal Function Error

2010-10-28 Thread Rob Antonishen
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?

2010-10-25 Thread Sven Neumann
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


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-04 Thread saulgoode
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

2010-10-04 Thread Alan Campbell
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


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Sven Neumann
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

2010-10-03 Thread Alan Campbell


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

2010-10-03 Thread Sven Neumann
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

2010-10-03 Thread Alan Campbell

  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

2010-09-12 Thread saulgoode
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

2010-09-11 Thread Alan Campbell

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

2010-09-11 Thread Sven Neumann
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

2010-09-11 Thread Alan Campbell

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

2010-09-10 Thread Alan Campbell
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

2010-09-10 Thread saulgoode
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


Re: [Gimp-user] script-fu: saving dialog choices

2010-09-05 Thread saulgoode
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

2010-07-24 Thread Kevin Cozens
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

2010-07-24 Thread Dillon
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

2010-07-24 Thread Dillon
 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

2010-07-24 Thread Dillon
 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

2010-07-24 Thread saulgoode
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

2010-07-23 Thread Dillon
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


Re: [Gimp-user] script-fu-round-corners

2010-06-15 Thread John Dey
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:

(define (round-corners filein fileout)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filein filein)))
   (drawable (car (gimp-image-get-active-layer image
 (set! drawable (car (gimp-image-flatten image)))
 (script-fu-round-corners image drawable 
  15.0 TRUE 8.0 8.0 15.0 TRUE FALSE)
 (set! drawable (car (gimp-image-flatten image)))
 (gimp-file-save RUN-NONINTERACTIVE image drawable fileout fileout)
 (gimp-image-delete image)))

Thanks for your help.

John
On Jun 15, 2010, at 11:00 AM, John Dey wrote:

 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

___
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

2010-06-15 Thread Rob Antonishen
 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-06-07 Thread Deniz Dogan
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

2010-06-07 Thread Dillon
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


Re: [Gimp-user] Script-Fu for batch image conversion

2010-06-06 Thread saulgoode
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

2010-06-06 Thread Dillon
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-06-06 Thread Deniz Dogan
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

2010-06-06 Thread Dillon
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

2010-06-06 Thread saulgoode
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

2009-11-25 Thread Simon Budig
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

2009-11-25 Thread Thomas DuBuisson
 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


Re: [Gimp-user] Script-Fu Exceptions and errors

2009-11-24 Thread Thomas DuBuisson
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

2009-11-24 Thread Thomas DuBuisson
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

2009-09-15 Thread Ilya Zakharevich
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

2009-09-14 Thread Sven Neumann
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

2009-09-14 Thread Ilya Zakharevich
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

2009-09-13 Thread Ilya Zakharevich
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


Re: [Gimp-user] Script fu may call Gegl operation ?

2009-09-12 Thread Sven Neumann
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


Re: [Gimp-user] Script-fu for multi-language

2009-03-01 Thread Tetsuya Yuasa
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

2009-02-27 Thread saulgoode
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

2009-02-27 Thread Tetsuya Yuasa
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

2009-02-27 Thread Marco Ciampa
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


Re: [Gimp-user] Script-Fu

2009-02-19 Thread Frantz de Germain
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

2009-02-18 Thread saulgoode

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

2009-02-18 Thread Frantz de Germain
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

2009-02-18 Thread saulgoode
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

2009-02-18 Thread Claus Cyrny
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

2009-02-18 Thread saulgoode
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


Re: [Gimp-user] Script-Fu

2009-02-17 Thread David Gowers
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


Re: [Gimp-user] script-fu code to load pdf with set resolution

2008-10-22 Thread Sven Neumann
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


Re: [Gimp-user] script-fu code to load pdf with set resolution

2008-10-21 Thread saulgoode
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


Re: [Gimp-user] script-fu-save-anim-layers

2008-10-19 Thread Sven Neumann
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

2008-10-19 Thread Kevin Cozens
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

2008-10-19 Thread Alec Burgess

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


Re: [Gimp-user] script-fu-save-anim-layers

2008-10-18 Thread Sven Neumann
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

2008-10-18 Thread saulgoode
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

2008-10-16 Thread Adonj Adonj

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


Re: [Gimp-user] Script Fu error

2008-10-15 Thread Andreas Waechter
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


Re: [Gimp-user] Script Fu error

2008-10-15 Thread D.Jones (aka) Capnhud
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


Re: [Gimp-user] script-fu plugin

2008-09-30 Thread Bernd Weber
 Goode
  Saul Goode
  6/14/2006
  
  SF-IMAGEImage0
  SF-DRAWABLE Drawable 0
  )

 _



 --

 Message: 2
 Date: Sun, 28 Sep 2008 11:28:50 +0300
 From: peter kostov [EMAIL PROTECTED]
 Subject: Re: [Gimp-user] script-fu plugin
 To: Adonj Adonj [EMAIL PROTECTED]
 Cc: gimp-user@lists.XCF.Berkeley.EDU
   gimp-user@lists.xcf.berkeley.edu
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=UTF-8; format=flowed

 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't  that 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

 


   

___
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

2008-09-28 Thread peter kostov
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


Re: [Gimp-user] script-fu plugin

2008-09-28 Thread saulgoode
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


Re: [Gimp-user] Script-fu plugin

2008-09-28 Thread saulgoode
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


Re: [Gimp-user] script-fu batch file

2008-09-25 Thread Sven Neumann
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

2008-05-18 Thread Xavier Mas
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


Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals

2008-05-17 Thread Jonathan Dearborn
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

2008-05-17 Thread Kevin Cozens
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

2008-05-16 Thread Jonathan Dearborn
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

2008-05-16 Thread Torsten Neuer
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

2008-05-15 Thread Sven Neumann
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


Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals

2008-05-15 Thread Torsten Neuer
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


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

2008-05-14 Thread Torsten Neuer
Hello,

 I've been having trouble finding how to encode UTF-8 special characters
 into a string literal in Script-fu.  Could someone provide an example of
 how to hard-code international characters into a string?

The simplest and easiest way is to use a text editor that is capable of 
switching text encoding.  One of those editors would be Emacs, which is also 
available on many platforms (from the menu select: Options - Mule - Set 
Language Environment - UTF-8).


  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

2008-05-14 Thread Jonathan Dearborn
Do you mean just type them in?  That isn't working for me.  Wouldn't switching 
the encoding affect the whole file instead of just a particular string?  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).  Typing them into a string isn't 
working.  I've tried escaping them and using the hex value with \x, but that 
didn't seem to fly with Script-fu.  'format' isn't available either.  The Gimp 
2.4 supposedly supports these characters, but I just haven't seen the 
documentation to back it up.  Is there another way that you know of?

Thanks for your help,
Jonny D



 From: [EMAIL PROTECTED]
 To: gimp-user@lists.xcf.berkeley.edu
 Date: Wed, 14 May 2008 16:28:25 +0200
 Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals
 
 Hello,
 
  I've been having trouble finding how to encode UTF-8 special characters
  into a string literal in Script-fu.  Could someone provide an example of
  how to hard-code international characters into a string?
 
 The simplest and easiest way is to use a text editor that is capable of 
 switching text encoding.  One of those editors would be Emacs, which is also 
 available on many platforms (from the menu select: Options - Mule - Set 
 Language Environment - UTF-8).
 
 
   Torsten

_
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu gimp-file-save-thumbnail function

2008-01-07 Thread Martin Bradley
Hi Joao,

 May I suugest this code instead of the above? :
 
 from gimpfu import *
 def python_fu_create_thumb(filename):
 img = pdb.gimp_file_load(filename, filename)
 pdb.gimp_file_save_thumbnail(img, filename)
 
 register (
 python-fuc-create-thumb,
 Create Thumbnail of Image File,
 Create Thumbnail of Image File,
 Marty Bradley,
 Marty Bradley,
 jan 2008,   
  ,
  Toolbox/Xtns/Script-Fu/Utils/Thumbnail...,
  [(PF_FILENAME, Image Name. Filename of the iamge to create 
 thumbnail, )],
  [],
  python_fu_create_thumb
 )
 main()

I don't want to try to get your code working because I know nothing
about Python, I know it is a good language.  The other reason I'm not
happy using it is that it adds another layer of software to a solution
that should work on its own.


I have still been unable to get the following to work.

(define (script-fu-create-thumb filename)
  (let* ((img 0))
;; car needed here because gimp functions return values as lists
(set! img (car (gimp-file-load 1 filename filename)))
 (gimp-file-save-thumbnail img filename)))

(script-fu-register script-fu-create-thumb
Toolbox/Xtns/Script-Fu/Utils/Thumbnail...
Thumbnail Image
Marty Bradley
Marty Bradley
Dec 2007

SF-FILENAME Image Name  )



Any other pointers would be gladly accepted.

regards,
Martin.


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu gimp-file-save-thumbnail function

2008-01-07 Thread Manish Singh
On Mon, Jan 07, 2008 at 07:30:22PM +, Martin Bradley wrote:
 I don't want to try to get your code working because I know nothing
 about Python, I know it is a good language.  The other reason I'm not
 happy using it is that it adds another layer of software to a solution
 that should work on its own.

If you don't want to learn Python that's fine, but please don't spread
made up misinformation. PyGIMP and Script-fu both talk to the GIMP PDB
directly, there is no extra layer in the Python case.

-Yosh
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu gimp-file-save-thumbnail function

2008-01-04 Thread Kevin Cozens
Martin Bradley wrote:
 (define (script-fu-create-thumb filename)
   (let* ((img 0))
 ;; car needed here because gimp functions return values as lists
 (set! img (car (gimp-file-load 1 filename filename))
  (gimp-file-save img filename)
  (print (gimp-file-save-thumbnail img filename
   )
[snip]
 SF-VALUE Image Name  

You have an error in your placement of ')'. You have one too few at the end of 
the set! line and one too many at the end of the print line.

You have the wrong number of arguments in the call to gimp-file-save. You can 
see the list of required arguments in the Procedure Browser. I don't think you 
need the file save since you haven't changed the file since it was loaded.

The SF-VALUE in the register block should be SF-FILENAME.

 Later on I edited the function to be as shown below. 
[snip]
  (when (gimp-file-save-thumbnail img)
(gimp-message thumbnail saved?)

Where did you come up with 'when'? There is no such function in Script-Fu.

-- 
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 gimp-file-save-thumbnail function

2008-01-04 Thread Martin Bradley
Hi Folks,

You have an error in your placement of ')'.
That was because I thought set was used similar to (let ..)  

I don't think you need the file save since you haven't changed the file since 
it was loaded.
I have corrected the arguments. I saved the file first because
gimp-file-save-thumbnail documentation suggested to do so.  I've since
removed it.

The SF-VALUE in the register block should be SF-FILENAME.
Yes, had already manage to correct this.

 Where did you come up with 'when'? There is no such function in Script-Fu.
I'd been slowly trying to learn Common Lisp and thought that Script-Fu had it.
Here is the scheme coding tutorial I was using, most likely the wrong
thing to be reading.
http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-1.html#node_toc_node_sec_4.1



(define (script-fu-create-thumb filename)
  (let* ((img 0))
;; car needed here because gimp functions return values as lists
(set! img (car (gimp-file-load 1 filename filename)))
 (gimp-file-save-thumbnail img filename)))

(script-fu-register script-fu-create-thumb
Toolbox/Xtns/Script-Fu/Utils/Thumbnail...
Thumbnail Image
Marty Bradley
Marty Bradley
Dec 2007

SF-FILENAME Image Name  )

thank you,
Martin

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu gimp-file-save-thumbnail function

2008-01-04 Thread Kevin Cozens
Martin Bradley wrote:
 I'd been slowly trying to learn Common Lisp and thought that Script-Fu had it.
 Here is the scheme coding tutorial I was using, most likely the wrong
 thing to be reading.
 http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-1.html#node_toc_node_sec_4.1

Script-Fu scripts are based on the Scheme language. Scheme is a dialect of 
Lisp. There are a number of Scheme interpreters which may offer slightly 
different features and compliance with the Scheme standards. The web page you 
are reading appears to be for the Scheme variant used in mzscheme.

Script-Fu as of GIMP 2.4 more closely follows the R5RS. The document you 
should be reading can be found at 
http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf.

Some aspects described in the R5RS are not supported in Script-Fu. 
define-syntax is one of them.

-- 
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 gimp-file-save-thumbnail function

2008-01-04 Thread Joao S. O. Bueno
On Friday 04 January 2008 19:35, Martin Bradley wrote:
 Hi Folks,

 You have an error in your placement of ')'.

 That was because I thought set was used similar to (let ..)

 I don't think you need the file save since you haven't changed the
  file since it was loaded.

 I have corrected the arguments. I saved the file first because
 gimp-file-save-thumbnail documentation suggested to do so.  I've
 since removed it.

 The SF-VALUE in the register block should be SF-FILENAME.

 Yes, had already manage to correct this.

  Where did you come up with 'when'? There is no such function in
  Script-Fu.

 I'd been slowly trying to learn Common Lisp and thought that
 Script-Fu had it. Here is the scheme coding tutorial I was using,
 most likely the wrong thing to be reading.
 http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-1.html#
node_toc_node_sec_4.1



 (define (script-fu-create-thumb filename)
   (let* ((img 0))
 ;; car needed here because gimp functions return values as
 lists (set! img (car (gimp-file-load 1 filename filename)))
  (gimp-file-save-thumbnail img filename)))

 (script-fu-register script-fu-create-thumb
 Toolbox/Xtns/Script-Fu/Utils/Thumbnail...
 Thumbnail Image
 Marty Bradley
 Marty Bradley
 Dec 2007
 
 SF-FILENAME Image Name  )

May I suugest this code instead of the above? :

from gimpfu import *
def python_fu_create_thumb(filename):
img = pdb.gimp_file_load(filename, filename)
pdb.gimp_file_save_thumbnail(img, filename)

register (
python-fuc-create-thumb,
Create Thumbnail of Image File,
Create Thumbnail of Image File,
Marty Bradley,
Marty Bradley,
jan 2008, 
 ,
 Toolbox/Xtns/Script-Fu/Utils/Thumbnail...,
 [(PF_FILENAME, Image Name. Filename of the iamge to create 
thumbnail, )],
 [],
 python_fu_create_thumb
)
main()

So, but for the many parameters to the regiser function, (whuch IMHO 
is a missdesign of the python bindings), you have just two lines of 
code  which are very straight and readable. 
No need to match odd parenthesis, no need to worry about lists, and 
getting elements inside lists, no need to pre-declare variable in an 
obscure let statement.

regards,

js
--


 thank you,
 Martin

 ___
 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 needed: apply Auto-White-Balance on all images...

2007-12-17 Thread Kevin Cozens
[EMAIL PROTECTED] wrote:
 I needed a script-fu routine that apply Auto-White-Balance on all OPENED 
 images...
 Like the Save-All script-fu that provided by an user in this list.
 
 I don't wanna use outer tool, because sometimes the Auto-White-Balance 
 is makes wrong result.

By outer tool I assume you are referring to the menu item. The difference 
between the menu item and using the function from a script is the script 
callable version allows you to specify whether it should use adjust based on 
shadow, mid-tones, or hightlights. The menu item doesn't give you a choice. It 
just uses whatever it has as its default settings.

You could easily modify the Save All script to do what you want. The main 
change involves replacing the call to gimp-file-save with a call to 
gimp-color-balance with the parameters you want to use. You also want to 
change the name of the script from script-fu-save-all-images to something more 
appropriate, and edit the register block to put the script under 
Image/Colors/Auto.

There are several scripts (ie. chrome-it.scm) which are shipped with GIMP that 
make a call to gimp-color-balance if you are unsure about the parameters you 
need to pass.

-- 
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 help?

2007-11-07 Thread Tobias Jakobs
On Nov 7, 2007 8:53 PM, Dave 77459 [EMAIL PROTECTED] wrote:
 I have some scripts I am upgrading to work with 2.4.  What is the best place
 to find help?

This list is the right place. I think the fastes way to get help is
the GIMP IRC channel.
If you are updating from 2.2 to 2.4 you can find here an Script-Fu
Migration Guide:
http://gimp.org/docs/script-fu-update.html

Regards,
Tobias
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu errors after upgrade 2.2.15 = 2.4.0-rc2

2007-09-07 Thread Pere Pujal i Carabantes
El dv 07 de 09 del 2007 a les 15:19 +0200, en/na Jan Tomasek va
escriure:

 I seek help with migrating script-fu script from Gimp 2.2 to 2.4.

 
 After upgrade to 2.4.0-rc2 script stoped working, first I found problem 
 with (set! variable ...) syntax, I replaced that by (define variable 
 ...) and now I'm getting Procedural database execution of 
 gimp-floating-sel-anchor failed: error without any further explanation 
 of problem. I've no idea what get wrong there.
 
  (define rtText
 (car
  (gimp-text-fontname
   img -1
Why you put img -1 ?? you don't have this in the version for gimp 2.2

And BTW, putting here the old value your script will work.

 
 Is there some script-fu migration howto? Or maybe on this list is 
 someone so kind to check my script... it is attached to this email.
 

There are nice pages to read:
http://www.ve3syb.ca/software/gimp/tiny-fu.html
http://www.ve3syb.ca/software/gimp/extras.html


 Best regards

Yours
Pere

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu SF-FILENAME don't show the default setting

2007-09-03 Thread Pere Pujal i Carabantes
On Wed, 2007-08-29 at 01:17 +0200, Pere Pujal i Carabantes wrote:

 When using SF-FILENAME, if the file exist, the name of the file is
 shown
 in the button, but if the file does not exist, ie. has to be created,
 there is (none) in the button.
 
 Is there a way to show the name on the button even if the file does
 not
 exist? 

After some try/error and a look at the code, it seems not. 

SF-Filename uses gtk_file_chooser_button, and acording to
http://library.gnome.org/devel/gtk/2.10/GtkFileChooserButton.html#id3631060
gtk_file_chooser_button only supports the GtkFileChooserActions
GTK_FILE_CHOOSER_ACTION_OPEN and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
not the GTK_FILE_CHOOSER_ACTION_SAVE

GTK_FILE_CHOOSER_ACTION_OPEN Indicates open mode. The file chooser will
only let the user pick an existing file. 
GTK_FILE_CHOOSER_ACTION_SAVE Indicates save mode. The file chooser will
let the user pick an existing file, or type in a new filename.


So, if someone like I wants to write a nonexistent file, and this file
has to be selected by the user, the obvious solution is to use
SF-DIRNAME to get the directory and follow a SF-STRING to get the
filename.
After that, a (string-append dirname / filename) in the code gives the
full path.

Yours
Pere

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu help

2007-05-29 Thread RalfGesellensetter
Am Montag 28 Mai 2007 21:13 schrieb ASJF:
 I
 have change something but I don't remember what...
 Can someone help me?

Don't you have a working copy? If you don't use a CVS/SVN, you might get 
help from diff (or kdiff3 if you use KDE).

Otherwise: Thanks for sharing your script ;)
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu help

2007-05-28 Thread saulgoode
Quoting ASJF [EMAIL PROTECTED]:

 Hi everybody !

 I have made a script to resize picture... but it doesn't work anymore, I
 have change something but I don't remember what...
 Can someone help me?

I suspect that you are using the development version (2.3) of the GIMP  
and your difficulty is caused by the fact that Script-fu has become  
more demanding that you follow proper Scheme programming guidelines  
than it used to be.

In previous versions of Script-fu, you were allowed to 'set!' an  
undeclared variable and Script-fu would happily go ahead and define it  
for you. This is no longer acceptable -- you must declare your  
variables (with either 'define' or 'let*') before you use them.

In particular, you have two variables -- 'f1-height' and 'f1-width' --  
which need to be included in your 'let*' block. Once you do this, I  
think you will find your script to be functional.

___
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

2007-03-13 Thread Sven Neumann
Hi,

On Tue, 2007-03-13 at 05:47 +0100, Stephan Hegel wrote:

 However, I do think the problem itself will be a user issue even when I'm a
 bit ahead at the moment and have tried the developer version already. When
 you release version 2.4 (or a release candidate of it) the problem will pop
 up for users: the new Script-Fu interpreter will lead to unexpected error
 messages with existing third party scripts.
 
 Any plans how to avoid this ?

Yes, as you probably already read in the archives, we are looking for a
volunteer to write a document that explains the changes and how to fix
scripts that stop working.

When such a document exists, we may even decide to change the error
messages and make them point to the document online.


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 error

2007-03-12 Thread Sven Neumann
Hi,

On Mon, 2007-03-12 at 07:20 +0100, Stephan Hegel wrote:

 I've tried Gimp 2.3.15 with the following script:
 http://turtle.as.arizona.edu/jdsmith/exposure-blend.scm
 
 When launching Gimp I get the following error:
 
 script-fu-Warning: Error while executing
 (load /home/steve/.gimp-2.3/scripts/exposure-blend.scm)
 Error: set!: unbound variable: script-fu-exposure-blend-options
 
 The same plug-in behaves just fine in Gimp-2.2. Any hint what's
 wrong and/or how to track this down ?

Since you are using the development version, you should be subscribed to
the gimp-developer mailing-list. We haven't written a decent document
describing the changes in Script-Fu yet, but you can read about them in
the mailing-list archives.


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 error

2007-03-12 Thread Stephan Hegel
Hello Sven,

Sven Neumann wrote:
 Since you are using the development version, you should be subscribed to
 the gimp-developer mailing-list. We haven't written a decent document
 describing the changes in Script-Fu yet, but you can read about them in
 the mailing-list archives.
Thanks for the pointer. I've found the explanation in the mailing list
archive.

However, I do think the problem itself will be a user issue even when I'm a
bit ahead at the moment and have tried the developer version already. When
you release version 2.4 (or a release candidate of it) the problem will pop
up for users: the new Script-Fu interpreter will lead to unexpected error
messages with existing third party scripts.

Any plans how to avoid this ?

Kind regards,
Stephan.

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-Fu Question about Saving Image to Network Share

2007-03-10 Thread Sven Neumann
Hi,

On Sat, 2007-03-10 at 12:58 -0500, Tony Freeman wrote:

 If saving to a network drive is not possible (such as smb://), is there 
 some other trick I could use to get the image over there? 

GIMP 2.2 doesn't save to remote locations. You could try your luck with
the 2.3 development version or use the command-line utility gnomevfs-mv
to move the file to the SMB share.


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 Question about Saving Image to Network Share

2007-03-10 Thread GSR - FR
Hi,
[EMAIL PROTECTED] (2007-03-10 at 1258.19 -0500):
 If saving to a network drive is not possible (such as smb://), is there 
 some other trick I could use to get the image over there? 

Mount the network drive. You can use smbmount or fusesmb, for
example. Then files will appear in the main tree, for all apps.

GSR
 
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-FU console query

2007-01-14 Thread Saul Goode
Sven Neuman wrote:
 
 On Sat, 2007-01-13 at 20:33 -0800, Saul Goode wrote:
 
  Note that you will see no change in the display; even if you were to
  perform a 'gimp-displays-flush'. 
 
 If that is true, then this is a bug and needs to be fixed. Can you
 provide a test script that illustrates the problem?

Step #1: Create a new image with a white background (any size will do)
and zoom in to the upper left corner. 

Step #2: Open the Script-fu console and enter the following commands
(the number 1 in the first line assumes the new image is the first one
created after opening the GIMP; substitute the appropriate image-IDnum
from the window's titlebar if this is not the case):

  (define image 1)
  (define layer (car (gimp-image-get-active-layer image)))
  (gimp-drawable-set-pixel layer 1 1 3 (cons-array 3 'byte))

Note that at this point, the pixel at location x=1, y=1 has internally
been painted BLACK ('cons-array' initializes to [0,0,0]) but the display
has not been updated.

Step #3: Enter the following line in the console:

  (gimp-displays-flush)

Note that the display is not updated -- this is somewhat anomalous (but
then Script-fu is not often used to paint on a pixel-by-pixel basis).

Step #4: Hide and then unhide the layer by toggling its eyeball in the
Layers window. At this point the projection is updated to reflect that
the pixel at [1,1] has been painted black.


It is amazing what you can accomplish if you do 
not care who gets the credit. -- Harry S. Truman

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-FU console query

2007-01-14 Thread Kevin Cozens
Adam wrote:
 Like in the following, which the Procedure Browser 
 says should be; 
 num_images INT32  The number of Images open
 image_ids  INT32ARRAY  The list of images currently open

 = (gimp-image-list)
 (1 #(2)#102)

   
 so,   #(2)#102
 is a single entry array of the image ID ? 
 How should I interpret this sequence ? 
   
Start by ignoring everything between the two close parentheses. There 
appears to be a bug in the output from the 2.2 version of GIMP. Using 
the current development version of GIMP I opened two files and asked for 
the image list. The result was
(2 #( 2 1 ))

The easy way to get the image ID when you need it as an argument for a 
command you want to run from the console mode is to look at the title 
bar of the image windows. Regardless of the file name, the filename (or 
the word 'Untitled' if it is a new image) shown in the title bar has 
text of the form -x.y at the end. The x part is the number that would 
be used as the image ID for that image.

 So I try another command; 
 = (gimp-image-height image)
 ERROR: unbound variable (errobj image)
   
You need to use the actual image ID (ie. number) in the call or define 
image and set it to the desired number before you attempt to use it in a 
call to a GIMP function.

-- 

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 console query

2007-01-14 Thread Sven Neumann
Hi,

On Sun, 2007-01-14 at 12:24 -0800, Saul Goode wrote:

   (define image 1)
   (define layer (car (gimp-image-get-active-layer image)))
   (gimp-drawable-set-pixel layer 1 1 3 (cons-array 3 'byte))
 
 Note that at this point, the pixel at location x=1, y=1 has internally
 been painted BLACK ('cons-array' initializes to [0,0,0]) but the display
 has not been updated.

You also need to call gimp-drawable-update (and of course
gimp-displays-flush).


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 console query

2007-01-14 Thread Adam

Thanks Kevin.  Understood. 
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-FU console query

2007-01-14 Thread Adam

Just tried, and set-pixel works for me using the Saul test
method.   Yes,  I had to toggle the 'eyeball' to get it 
to appear - yet to try gimp-drawable-update / gimp-displays-flush.

Thanks, gentlemen, for clearing my original 'image' 
and 'drawable' query.   


Welcome to SIOD, Scheme In One Defun
(C) Copyright 1988-1994 Paradigm Associates Inc.

Script-Fu Console - Interactive Scheme Development

= (gimp-version)
(2.2.8)

= (gimp-image-list)
(1 #(1)#101)

= (gimp-image-get-layers 1)
(1 #(2)#102)

= (define image 1)
1

= (define layer (car (gimp-image-get-active-layer image)))
2

=  (cons-array 3 'byte)
#300

=  (gimp-drawable-set-pixel layer 1 1 3 (cons-array 3 'byte))
()
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-FU console query

2007-01-13 Thread Saul Goode
I will do my best to explain some things.

 Simple commands work, using 'Apply' from the 
 Procedure Browser screen, like; 
 
 = (gimp-version)
 (2.2.8)

Note that the return value is a LIST containing the string 2.2.8. All
PDB functions return a LIST of items even if that list only contains one
item (indeed, the majority of the query-type commands return a one-item
list; requiring '(car ret-value)' to access the item itself).

 From there on, I have difficulty understanding the 
 Return Values, and the requirements for the 
 function parameters suchs as; CHANNELS, 
 DRAWABLE. 

IMAGEs, CHANNELs, DRAWABLEs, LAYERs, DISPLAYs, et cetera are all integer
 IDs which are unique within their group (you might have an IMAGE with
an  ID of 3 and LAYER with an ID of 3, but you will never have two
layers with an ID of 3 at the same time). They would all seem to be
non-negative integers greater than zero (I think it is a fair assumption
that this will always be the case).

DRAWABLEs are a superset of LAYERs, CHANNELs, and LAYERMASKS. 

A LAYER is an arbitrary-sized bitmap that can be either RGB or
GRAYSCALE. By arbitrary-sized, I mean that its dimensions are not bound
by the image dimensions (nor is its position, a LAYER can be completely
outside the image).

A CHANNEL is a fixed-sized, GRAYSCALE bitmap whose dimensions are fixed
and whose position is anchored. If the CHANNEL is a LAYERMASK then the
size and position are the same as the the LAYER to which it belongs.
Otherwise, the CHANNEL's size and dimensions are the same as the IMAGE's.

These identification numbers are what is expected (and what are
returned) when you see them referenced in the PDB. They are simple
integers (i.e., they are NOT pointers or structures) and you can specify
 them explicitly as such in the Script-fu console. For example:

(gimp-image-get-active-layer 1)

Will return the active layer for IMAGE 1 (the IMAGE-ID, 1, is
assigned to the first image you open with the GIMP)

 Like in the following, which the Procedure Browser 
 says should be; 
 num_images INT32  The number of Images open
 image_ids  INT32ARRAY  The list of images currently open
 
 = (gimp-image-list)
 (1 #(2)#102)

The LIST returned contains two items: the second item is an array of
active IMAGE-IDs and the first item is the size of the array. To access
an entry in the array, use 'aref':

(define all-images (gimp-image-list))
(define first-image (aref (cadr all-images) 0))
(define last-image (aref (cadr all-images) (- (car all-images) 1))

The value of an IMAGE-ID is appended to the filename in the window's
titlebar; which makes interaction from within the console easier. For
example, Untitled.png-#1.0 in the titlebar indicates that the IMAGE-ID
is 1 (the 0 indicates the DISPLAY-ID, and will be zero unless you
have more than one view open for the same image).

 If someone could give me an example of using the 
 Script-FU Console to work gimp-drawable-set-pixel  
 that would be great.

In order to use 'gimp-drawable-set-pixel', you must create a byte-array
for the pixel's color. This can be accomplished with the following function:
 
(define (color-as-bytes r g b a) 
  (let* ((color (cons-array 4 'byte)))
(aset color 0 r) 
(aset color 1 g)
(aset color 2 b)
(aset color 3 a))
color
)
  )  

Once that function is defined (and assuming that my description of
drawables wasn't completely unfathomable), you would use the following
command to set a pixel on an RGB drawable:

(gimp-drawable-set-pixel drawable 1 1 4 (color-as-bytes red blue green
alpha))

Note that you will see no change in the display; even if you were to
perform a 'gimp-displays-flush'. The set-pixel command does not register
with the UNDO history (it might be problematic to UNDO a few million
pixel ops) and therefore you must manually force an update to the
display to see the change (I would recommend hiding-and-unhiding the layer).



It is amazing what you can accomplish if you do 
not care who gets the credit. -- Harry S. Truman

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-FU console query

2007-01-13 Thread Saul Goode
In my response, I had a cut-n-paste error in the last code-segment. The
line:

  (gimp-drawable-set-pixel drawable 1 1 4 (color-as-bytes red blue green
alpha))

should be changed to:

  (gimp-drawable-set-pixel drawable x-coord y-coord 4 (color-as-bytes
red blue green alpha))

The 4 in the line refers to the bytes-per-pixel and would be 2 if
the drawable were grayscale. A '(grayscale-as-bytes value alpha)'
function should then be defined to create a 2-byte array.


It is amazing what you can accomplish if you do 
not care who gets the credit. -- Harry S. Truman

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-fu : gimp-text-fontname and text variable

2006-09-20 Thread Sven Neumann
Hi,

On Wed, 2006-09-20 at 00:15 +0200, Nicolas wrote:

 I made a script-fu script, in which I write some text, using this
 syntax:
 
  (set! text-float (car (gimp-text-fontname img texteblanc 66 448
  text_to_write 0 1 34 0 FleurishScript Ultra-Light)))
 
 Photo is a variable :
 SF-VALUEtext_to_write )

It would help if you showed us the full script. From the snippets you
posted so far, I can only guess that you misunderstood the concept of
variable declaration in Script-Fu.


Sven


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


  1   2   >