Re: [Gimp-user] Suppressing the press any character to close this window message in Script-Fu

2010-08-06 Thread Dillon
Thank you Sven - that fixed it!

On Tue, Aug 3, 2010 at 12:00 PM, gimp-user-


 --

 Message: 1
 Date: Mon, 02 Aug 2010 22:17:51 +0200
 From: Sven Neumann s...@gimp.org
 Subject: Re: [Gimp-user] Suppressing the press any character to close
this window message in Script-Fu
 To: Dillon dillonontheco...@gmail.com
 Cc: gimp-user@lists.xcf.berkeley.edu
 Message-ID: 1280780271.2831.2.ca...@bender
 Content-Type: text/plain; charset=UTF-8

 On Sun, 2010-08-01 at 01:48 -0700, Dillon wrote:

 You get this message because you are running the copy of GIMP that was
 compiled as an interactive application with UI. If you don't want any
 UI, then don't start the gimp binary, but use the gimp-console binary
 instead.


 Sven




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


Re: [Gimp-user] Suppressing the press any character to close this window message in Script-Fu

2010-08-02 Thread Sven Neumann
On Sun, 2010-08-01 at 01:48 -0700, Dillon wrote:
 Hi all,
 
 
 I've written a series of scripts to automate GIMP's script-fu batch
 processor.  Right now I'm working on starting up multiple asynchronous
 GIMP processes.  
 
 
 The problem I'm having right now is with the interactive press any
 character to close this window message that appears when GIMP
 finishes processing a piece of Script-Fu.

You get this message because you are running the copy of GIMP that was
compiled as an interactive application with UI. If you don't want any
UI, then don't start the gimp binary, but use the gimp-console binary
instead.


Sven



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


Re: [Gimp-user] Suppressing the press any character to close this window message in Script-Fu

2010-08-01 Thread saulgoode
Quoting Dillon dillonontheco...@gmail.com:

 The problem I'm having right now is with the interactive press any
 character to close this window message that appears when GIMP finishes
 processing a piece of Script-Fu.

 I want to suppress that message so that there is no user interaction
 required.

I'm not familiar with that message. Could you provide a little more  
detail about your process?

 I've written a series of scripts to automate GIMP's script-fu batch
 processor.  Right now I'm working on starting up multiple asynchronous GIMP
 processes.

Unless the image processing you are doing is quite involved, you might  
find that running a single GIMP instance to be faster if you pass all  
of the filenames to it at once. This way you avoid the somewhat  
lengthy startup times that GIMP usually experiences.


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


Re: [Gimp-user] Suppressing the press any character to close this window message in Script-Fu

2010-08-01 Thread Kevin Cozens
Dillon wrote:
 I've written a series of scripts to automate GIMP's script-fu batch
 processor.  Right now I'm working on starting up multiple asynchronous GIMP
 processes.
 
 The problem I'm having right now is with the interactive press any
 character to close this window message that appears when GIMP finishes
 processing a piece of Script-Fu.

I don't believe the message has anything to do with Script-Fu. The message 
about press any character... sounds like a message from a machine running 
the Windows operating system and it wants to close a window that was opened 
to run a program and that program has now terminated.

You can get more help if you would provide more information about your 
batch processing method and how you are invoking GIMP to run Script-Fu scripts.
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Suppressing the press any character to close this window message in Script-Fu

2010-08-01 Thread Dillon
Sorry guys.  I should realize that not everyone is following my plot :)

This is the same script / process you guys helped me with a week or two ago.
 I am running GIMP on a Windows machine.  I have a directory of XCF files
that I want to export to JPG.  I have a batch-save-as-jpg script-fu to do
this.  The script-fu is invoked from a PowerShell script.  That PowerShell
launches the GIMP batch processor and passes in the script-fu function,
scaling percentage, and a file glob.

##
#
#   START SCRIPT-FU
#
##
(define (batch-save-as-jpg pattern resize)
(let* (
(filelist (cadr (file-glob pattern 1)))
(fileparts)
(jpgname )
(filename )
(image 0)
(newimage 0)
(drawable 0)
(x1 0)
(x2 0)
(y1 0)
(y2 0)
(width 0)
(height 0)
(selection-bounds 0)
)
 (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 jpgname by tokenizing on . and taking everything but the last part
(set! fileparts (strbreakup filename .))
(set! fileparts (butlast fileparts))
(set! jpgname (string-append (unbreakupstr fileparts .) .jpg))
(gimp-message The new filename will be: )
(gimp-message jpgname)
 ; 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)))

; scale the image
(gimp-message Scaling the Image.)
; From the Resize %, calculate the new coordinates
 ; Select all so we can calculate the image size
(gimp-selection-all newimage)

(gimp-message Getting the Image Size)
; Get the image size and store in x1, x2, y1, and y2
(set! selection-bounds (gimp-selection-bounds newimage))
(set! x1 (cadr selection-bounds))
(set! y1 (caddr selection-bounds))
(set! x2 (- (cadr (cddr selection-bounds)) x1))
(set! y2 (- (caddr (cddr selection-bounds)) y1))

; De-select the selection
(gimp-selection-none newimage)

(gimp-message Calculating the new width and height.)
; Calculate the image width, height
(set! width (- x2 x1))
(set! height (- y2 y1))
 (set! width (* width resize))
(set! height (* height resize))
 (set! width (/ width 100))
(set! height (/ height 100))
 (gimp-message The new width is: )
(gimp-message (number-string  width))
 (gimp-message The new height is: )
(gimp-message (number-string height))

; set drawable to the newimage
(gimp-message Setting the Drawable.)
(set! drawable (car (gimp-image-flatten newimage)))
 ; Scale the image to the new width and height
(gimp-drawable-transform-scale drawable 0 0 width height 0 2 0 3 0)
; Crop the image down to the new scaled size
(gimp-image-crop newimage width height 0 0)
; Re-display the cropped image
(gimp-displays-flush)

; Remove any existing selections
(gimp-selection-none newimage)
  ; save the drawable from newimage as jpgname
(gimp-message Saving the new file.)
(gimp-file-save RUN-NONINTERACTIVE newimage drawable jpgname jpgname)
(set! filelist (cdr filelist))

)
)
  )

##
#
#   END SCRIPT-FU
#
##


##
#
#   START POWERSHELL
#
##

$Resize = 10
$SourcePath = c:\test\xcf
$GimpifiedSourcePath = $SourcePath -replace(\\, \\)
$Gimp = gimp-2.6.exe
$GimpParams = @(-i, -b,
`(batch-save-as-jpg\`$GimpifiedSourcePath\\*.*\` $Resize)`, -b,
`(gimp-quit 0)`)

$p = [diagnostics.process]::Start($Gimp, $GimpParams)
$p.WaitForExit()

##
#
#   END POWERSHELL
#
##

The Powershell is waiting for the GIMP process to complete before it
continues the script.  This is a problem becomes whenever that GIMP command
finishes, it leaves a hanging command-prompt window open that is waiting for
a key press before it will close.  This causes the PowerShell to stop
executing.

This is not standard behavior on Windows.  Other commands run this way would
briefly launch a command-prompt, execute, complete, and that command prompt
closes on its own.  If it's not part of Script-Fu, perhaps it's part of GIMP
batch mode?  If it's not GIMP that's waiting for input, perhaps it's a flag
set when launching the executable that tells Windows if it could close the
command prompt.  I don't really know where to look for this.

On Sun, Aug 1, 2010 at 12:00 PM,
gimp-user-requ...@lists.xcf.berkeley.eduwrote:



 Message: 5
 Date: Sun, 01 Aug 2010 11:01:07 -0400
 From: Kevin Cozens ke...@ve3syb.ca
 Subject: Re: [Gimp-user] Suppressing the press any character to close
this window message in Script-Fu
 To: gimp-user