Re: [Gimp-user] A request for your input.

2007-03-22 Thread Tony Freeman
I have a issue about a couple of your questions.  The one that prompted 
me to write this note is the one that says:

[quote]
Members of the open source community generally agree that 
1) You will make money by working on open source projects.
[/quote]

This somehow strikes me as a loaded statement.  The answer is obviously 
'strongly disagree'.  For instance,  I've written a game, it is open 
source and GPLv2 or whatever GPL version you choose.  I did not make any 
money because of it.  There was no open source fund that I was drawing 
from in order to write this game and make it available free over the 
internet.  Where's my pot of money for doing this?

I believe that the proper way to state this is and get a variety of 
answers is:

1) You CAN make money by working on open source projects.


-- Tony


[EMAIL PROTECTED] wrote:
> Hello
>
> My name is Lara Thynne and I am a PhD candidate at Deakin University
> Australia.  I am currently researching the boundary between work and
> leisure activities directly related to the open source community and
> open source program development.
>
> As part of this I am running a survey at the following address.
>
> https://dcarf.deakin.edu.au/surveys/oss/
>
> The survey is completely confidential and looks at your views and
> motivations to use Open Source software and to participate in the
> community.
>
> It will only take a five to ten minutes to complete and your contact
> details will not be recorded. You can withdraw your participation at
> any stage.
>
> I sincerely apologize for the spammish nature of this e-mail - I
> don't mean to abuse this list.  I am trying to collect responses
> from as many open source developers and users as possible and a
> mailing list like can be the only way to reach many developers.
>
> Thanks again
>
> Lara
>
> P.S The program that I am using is open source, of course
> (www.phpsurveyor.org)!
>
>
>
>
> ___
> 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] Unable to use 'system' command for script-fu <-- Almost done

2007-03-11 Thread Tony Freeman
Almost done!

One last thing that I cannot figure out is:  how do you close the dialog 
box that the image is sitting in?  In Scheme you do it like so:

(gimp-display-delete Image)

I've tried the following (with variations), but it causes the python-fu 
to hang:

pdb.gimp_display_delete(img)

Anyway ... here's the code so far:

#!/usr/bin/env python

#   Send to Web - Re-samples an image, adds drop shadow, and saves it
# to ls1 www images directory so that it can be used
# in a 'Top News of the Day' article.

import os
from gimpfu import *

def python_send_to_web(img, drawable, filename):
img.disable_undo()
   
# local variables:
SRCFilename = "/tmp/" + filename
RemoteDirectory = "ls1:/home/tony/"
SCPProgram = "/usr/bin/scp"
   
width = img.width
height = img.height

# hack to make the next section work:
blank_layer = gimp.Layer(img, "blank", width, height, RGB_IMAGE, 0, 
NORMAL_MODE)
img.add_layer(blank_layer, 0)
gimp.displays_flush()
   
# merge all the layers for just in case the user has done some editing:
pdb.gimp_image_merge_visible_layers(img, 0)
# screwed up the drawable when I merged the layers:
drawable = pdb.gimp_image_get_active_drawable(img)
   
# scale the image if it's too big:
if (width > 470):
newheight = ((height * 470) / width)
pdb.gimp_image_scale(img, 470, newheight)
gimp.displays_flush()
   
# add a drop shadow:
pdb.script_fu_drop_shadow(img, drawable, 8.0, 8.0, 15.0, [0,0,0], 
80.0, TRUE)
gimp.displays_flush()
   
# final layer merge:
pdb.gimp_image_merge_visible_layers(img, 0)
drawable = pdb.gimp_image_get_active_drawable(img)
   
# save the image in png format to disk:
pdb.file_png_save2(img, drawable, SRCFilename, filename, FALSE, 6, 
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE)
gimp.displays_flush()
   
# close the python-fu dialog box:
gimp.delete(img)
   
# send the image to our ls1 directory:
command = SCPProgram + " " + SRCFilename + " " + RemoteDirectory
os.popen(command)
   
# user needs some feedback:
pdb.gimp_message("Cool!  Your picture is online.  You may now 
include it in a 'Top News of the Day' article.")
   
# I'd like to be able to close the dialog that the image is sitting 
in ...
# but I cannot figure out how to do this.  I'll leave it open.  
Hopefully the
# user will not be too confused by this.
#pdb.gimp_display_delete(img)


register(
"python_fu_send_to_web",
"Send an image to ls1 rsync directory",
"Send image to ls1 for rsync to web farm after resampling it to 
proper size and adding drop shadow.",
"Tony Freeman <[EMAIL PROTECTED]>",
"National Weather Service, Louisville",
"2007",
"/NWS/Send to web...",
"RGB*, GRAY*",
[
(PF_STRING, "filename", "Filename", "web-image.png"),
],
[],
python_send_to_web)

main()

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


Re: [Gimp-user] Unable to use 'system' command for script-fu

2007-03-11 Thread Tony Freeman
Thanks Joao,

I see what you mean about C.  I just tried to do a drop shadow in C and 
could not find any examples.

I'm reading the python-fu stuff now :-)

-- Tony



Joao S. O. Bueno Calligaris wrote:
> On Sunday 11 March 2007 01:25, Tony Freeman wrote:
>   
>> OK, I found this site ... I'll be studying this for a while :-)
>>
>> http://developer.gimp.org/plug-in-template.html
>> 
>
> You really be better trying out pythhon scripts first.
>
> Only if you intend to perform image processing  - like performign some 
> algorithm on a pixel by pixel basis you'd have some advantage 
> writting a plug-in in C nowadays.
>
> The URL you did not find is:
>
> http://www.gimp.org/docs/python/index.html
> Also, take a look at the example plug-instahtcome withthe GIMP, anbd 
> try some python commands at the python console.
> Onm the python console, btw, start with:
>
> from gimpfu import *
> img = gimp.list_images()[0]
>
> --
> now you have your first image open in the gimp as a python object 
> named "img", and you can do :
>
> dir (img)  
>
>
> (for example:
>  img.scale (img.width * 0.5, img.height * 0.5)
> )
>
> to see the methods and properties available.
>
> Under the module pdb you have all the procedural database api, which 
> you can browse with ->Procedure Browser,as in:
>
> pdb.gimp_drawable_fill (img.layers[0], FOREGROUND_FILL)
>
> (followed by gimp.displays_flush() to see the effect)
>  
> all procedure names use  "_" instead of "-", and ignore (do not pass) 
> "interactive/non-interactive" parameters.
>
> .
> Now if you know that:
> 1) python blocks like procedure bodys, if blocks, for loop blocks are
>delimited only by intendation level, and statements that accept
>blocks end with a collon
> 2) The python for statement iterates over a list, and if you want
>numbers, use the "xrange" built-in function like:
> for i in xrange(1,11):
>print i
> 3) it is easier if you copy the call to the "register" function from
>an existing script and just update the entries for your case
>
> you are ready for python scripting.
>
> But, if you want to create a custom gtk+ interface instead of the 
> script-fu like automathed dialog, it is also possible - again, check 
> the docs and examples.
>
>   js
>   -><-
>
>
>
>
>   
>> -- Tony
>> 
> ___
> 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] Unable to use 'system' command for script-fu

2007-03-10 Thread Tony Freeman
OK, I found this site ... I'll be studying this for a while :-)

http://developer.gimp.org/plug-in-template.html

-- Tony


Tony Freeman wrote:
> Thanks for all the comments,
>
> I guess I'll investigate python-fu.
>
> I do not see a tutorial on the gimp website for python-fu
> (http://www.gimp.org/tutorials/#Script) so I'll be doing
> some googling ... would anyone happen to know of a
> good basic tutorial I could check out?
>
> Or better yet ... I like GTK/Glib ... maybe there's a tutorial
> or example you know of?
>
> -- Tony
>
>
> [EMAIL PROTECTED] wrote:
>   
>> Quoting Tony Freeman <[EMAIL PROTECTED]>:
>>
>>   
>> 
>>> Hello,
>>>
>>> I wonder if someone could help me with this problem I'm having using the
>>> 'system' command in a scheme file.
>>> 
>>>   
>> Unfortunately, the 'system' command is one of those rare SIOD  
>> functions that is not implemented in Script-fu. You may need to write  
>> a plug-in or a Python script to execute command line calls.
>>
>>
>> ___
>> Gimp-user mailing list
>> Gimp-user@lists.XCF.Berkeley.EDU
>> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
>>
>>
>>   
>> 
> ___
> Gimp-user mailing list
> Gimp-user@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
>
>
>   
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Unable to use 'system' command for script-fu

2007-03-10 Thread Tony Freeman
Thanks for all the comments,

I guess I'll investigate python-fu.

I do not see a tutorial on the gimp website for python-fu
(http://www.gimp.org/tutorials/#Script) so I'll be doing
some googling ... would anyone happen to know of a
good basic tutorial I could check out?

Or better yet ... I like GTK/Glib ... maybe there's a tutorial
or example you know of?

-- Tony


[EMAIL PROTECTED] wrote:
> Quoting Tony Freeman <[EMAIL PROTECTED]>:
>
>   
>> Hello,
>>
>> I wonder if someone could help me with this problem I'm having using the
>> 'system' command in a scheme file.
>> 
>
> Unfortunately, the 'system' command is one of those rare SIOD  
> functions that is not implemented in Script-fu. You may need to write  
> a plug-in or a Python script to execute command line calls.
>
>
> ___
> Gimp-user mailing list
> Gimp-user@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
>
>
>   
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] Unable to use 'system' command for script-fu

2007-03-10 Thread Tony Freeman
Hello,

I wonder if someone could help me with this problem I'm having using the 
'system' command in a scheme file.

[code]
; launch system call to copy image to our www directory on ldad
(set! command (string-append "/usr/bin/scp " SRCFilename " " 
RemoteImageDir))
(system command)
   
; Close out the image
(gimp-display-delete Image)
(delete-file SRCFilename)
[/code]

The first system call gives this error:

[error]
  Error while executing
  (script-fu-Send-to-Web 1 "web-image.png")
  ERROR: unbound variable (errobj system)
[/error]

The 'delete-file' call gives this error:

[error]
  Error while executing
  (script-fu-Send-to-Web 1 "web-image.png")
  ERROR: unbound variable (errobj delete-file)
[/error]

Below is the complete bit of code:

[code]
 (define RemoteImageDir "ls1:/home/tony/testdir/")

 (define
(script-fu-Send-to-Web Image Filename)
   
; the directory our file will be saved in
(set! SRCFilename (string-append "/tmp/" Filename))
   
; scale the image to our optimum web size
(set! width (car (gimp-image-width Image)))
(set! height (car (gimp-image-height Image)))
(if (> width 470)
(begin
(set! newHeight (/ (* 470 height) width))
(gimp-image-scale Image 470 newHeight)
(gimp-displays-flush)
)
)
   
; add a drop shadow
(set! drawable (car (gimp-image-get-active-drawable Image)))
(script-fu-drop-shadow Image drawable 8.0 8.0 15.0 '(0 0 0) 80.0 TRUE)
(gimp-displays-flush)
   
; save as png file to local drive
(gimp-image-merge-visible-layers Image 0)
(gimp-displays-flush)
(set! drawable (car (gimp-image-get-active-drawable Image)))
(file-png-save2 RUN-NONINTERACTIVE Image drawable SRCFilename 
Filename 1 9 0 0 0 1 1 0 0)
(gimp-displays-flush)
   
; launch system call to copy image to our www directory on ldad
(set! command (string-append "/usr/bin/scp " SRCFilename " " 
RemoteImageDir))
(system command)
   
; Close out the image
(gimp-display-delete Image)
(delete-file SRCFilename)
   
; Let user know it's online
(gimp-message "Cool!  Your picture is online.  You may now include 
it in a 'Top News of the Day' article.")
 )

 ; Register the function with the GIMP:
 (script-fu-register
"script-fu-Send-to-Web"
"/NWS/Send To Web"
"Scales the image to 500px width and saves it to www images rsync 
directory on LDAD."
"Tony Freeman"
"2007, National Weather Service"
"March 06, 2007"
"RGB* GRAY*"
SF-IMAGE"The Image"0
SF-STRING"File Name""web-image.png"
 )
[/code]

Any help would be appreciated.

-- Tony


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


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

2007-03-10 Thread Tony Freeman
Hello,

I'm writing a script-fu for use in my office.  The idea is to reduce the 
amount of steps the user needs to take in order to save an acquired 
screenshot to our website.
*
*The problem I am having is that I cannot seem to save a file to an 
smb:// type address.   This is the error I get when testing:

*[error]
*Could not open 'smb://ldad_images/screenshots/web-image.png' for writing: No 
such file or directory
Error while executing
(script-fu-Send-to-Web 1 "smb://ldad_images/screenshots/" "web-image.png")
ERROR: Procedural database execution failed:
(file_png_save2 1 1 5 "smb://ldad_images/screenshots/web-image.png" 
"web-image.png" 1 9 0 0 0 1 1 0 0)
*[/error]*


The script works just fine if I save the image to a local drive such as 
'/tmp/'.

Also, if I type this in a terminal:

nautilus smb://ldad_images/screenshots/

A file browser opens just fine into the shared 'screenshots' directory.

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? 

Suggestions would be helpful :-)


Here's the code I have thus far:

*[code]
*(define 
(script-fu-Send-to-Web Image Location Filename)

; the directory our file will be saved in
(set! SRCFilename (string-append Location Filename))

; scale the image to our optimum web size
(set! width (car (gimp-image-width Image)))
(set! height (car (gimp-image-height Image)))
(if (> width 470)
(begin
(set! newHeight (/ (* 470 height) width))
(gimp-image-scale Image 470 newHeight)
(gimp-displays-flush)
)
)

; add a drop shadow
(set! drawable (car (gimp-image-get-active-drawable Image)))
(script-fu-drop-shadow Image drawable 8.0 8.0 15.0 '(0 0 0) 80.0 TRUE)
(gimp-displays-flush)

; save as png file to our www directory on ldad (or wherever the user 
indicated)
(gimp-image-merge-visible-layers Image 0)
(gimp-displays-flush)
(set! drawable (car (gimp-image-get-active-drawable Image)))
(file-png-save2 RUN-NONINTERACTIVE Image drawable SRCFilename Filename 
1 9 0 0 0 1 1 0 0)
(gimp-displays-flush)

; Close out the image
(gimp-display-delete Image)

; Let user know it's online
(gimp-message "Cool!  Your picture is online.  You may now include it 
in a 'Top News of the Day' article.")
)

; Register the function with the GIMP:
(script-fu-register
"script-fu-Send-to-Web"
    "/NWS/Send To Web"
"Scales the image to 500px width and saves it to www images rsync directory 
on LDAD."
"Tony Freeman"
"2007, National Weather Service, Louisville"
"March 06, 2007"
"RGB* GRAY*"
SF-IMAGE"The Image" 0
SF-STRING   "Location"  "smb://ldad_images/screenshots/"
SF-STRING   "File Name" "web-image.png"
)*
**[/code]*

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