GimpTalk Announcement :
Try your digital-art skills against your fellow gimpers in GIMPtalk's Biweekly Art competition !


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Web Development Services . Convert FLV to Cell Phone Format
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 10 posts ]  


Author Message
Offline
 Post subject:
PostPosted: Sun Jul 02, 2006 9:54 pm 
User avatar

Joined:
Sun Jul 02, 2006 9:11 pm

Topics:
Posts: 2

Find User's Topics

So I've the following script working well thanks to previous posters:

Code:
;batch resize

(define
   (script-fu-batch-resize-this
      pattern
      resize)
   (let* ((filelist (cadr (file-glob pattern 1))))
      (while filelist
         (let* ((filename (car filelist))
            (image (car (gimp-file-load 1 filename filename)))
            (drawable (car (gimp-image-get-active-layer image)))
            (width (car (gimp-image-width image)))
            (height (car (gimp-image-height image))))
            (set! width (* width resize))
            (set! height (* height resize))
            (gimp-image-scale image width height)
            (gimp-file-save 1 image drawable filename filename)
            (gimp-image-delete image)
         )
         (set! filelist (cdr filelist))
      )
   )
)

(script-fu-register "script-fu-batch-resize-this"
   "<Toolbox>/Script-Fu/Utils/Batch resize this"
   "Resize all files that match the search pattern"
   "Michael Rost"
   "2006, Michael Rost"
   "Rev A - July 02, 2006"
   ""
   SF-VALUE "Search String" ""
   SF-VALUE "Resize Constant" "0.5"
)


As I mentioned, this script, since I've registered it with GIMP, runs well from the menu. My issue is that I can't get it to run from the Windows XP command line. I can run GIMP from the command line and even add some switches, such as gimp-2.2 -s to suppress the splash screen. But when I try gimp-2.2 -i -b '(script-fu-batch-resize-this "i:\\pictures\\resize\\*.jpg" .5)' '(gimp-quit 0)' the files aren't resized. When I monitor the task manger, I see gimp-2.2.exe and script-fu.exe load as processes. I also see a second instance of script-fu.exe load, but it terminates after a few seconds. At this point nothing has happened to my files and I have to manually end the gimp-2.2.exe and script-fu.exe processes.

So my question is if the batch processing functionality is not built into the win32 version of GIMP or perhaps I need to access it in a different way. I suppose I can always run scripts from the GIMP menu, but it seems much more elegant and correct to run them from a command line.

My questions + 1 is I've seen RUN-NONINTERACTIVE as an input to a procedure, but my documentation suggests that this input should be an integer which works fine. What's the preferred or correct method?



Top
 Profile  
 
Online
 Post subject:
PostPosted: Mon Jul 03, 2006 2:43 am 
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics:
Posts: 5016

Find User's Topics
I suspect the problem lies with the backslashes in the filename. I am not sure of this as the last time I tried to track down the problem, the person who started the thread chose a different solution.

When calling from the command line, try replacing "i:\\pictures\\resize\\*.jpg" with "i:/pictures/resize/*.jpg".

RUN-NONINTERACTIVE is a predefined constant integer.

_________________
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.


Top
 Profile  
 
Offline
 Post subject:
PostPosted: Fri Jul 28, 2006 12:38 pm 
User avatar

Joined:
Sun Jul 02, 2006 9:11 pm

Topics:
Posts: 2

Find User's Topics
Thanks for the suggestion. I've been away from this project for a little while, but I should have some time to play around with it this weekend and have some other features I'd like to add. I read the previous thread that was linked in your post and have noticed a lot of the same behavior.


Top
 Profile  
 
Offline
 Post subject:
PostPosted: Wed Aug 02, 2006 3:29 pm 

Joined:
Wed Aug 02, 2006 3:12 pm

Topics:
Posts: 2

Find User's Topics
Even I am having a similar kind of issue.
I am very new to GIMP, so please correct me if I am wrong.
I have installed GIMP2 and tried running the sample from the "http://gimp.org/tutorials/Basic_Batch/"

Tried execute the below line on the command prompt
gimp-2.2.exe --verbose -i -b '(simple-unsharp-mask "test.jpg" 5.0 0.5 0)' '(gimp-quit 0)'

Nothing happens, however a gimp-2.2 process is running but does not give me any output.
Kindly let me know if any other plugin needs to be present for batch command to work.

I have started of with the sample code, but I am looking out for a gimp batch command that would compress all the *.jpg files i.e Indexed image with optimum palette -> number of colours 2 and also flatten the image and finally save the file in the .png format. I have tried these steps thru the GUI but then a command line interface is what I am looking at.

Thanks in advance. This is a very critical requirement for my project and have been struggling all day today. Please help.
:s:


Top
 Profile  
 
Online
 Post subject:
PostPosted: Wed Aug 02, 2006 8:32 pm 
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics:
Posts: 5016

Find User's Topics
Make sure that the "test.jpg" file is in the same directory as the GIMP is searching. This will be the directory which first appears if you perform a "File->Open" from the Toolbox after first starting the GIMP.

You should also try to run your script from within the GIMP. Open the Script-fu Console ("Xtns->Script-fu->Script-fu console") and type in your command:

[*] (simple-unsharp-mask "test.jpg" 5.0 0.5 0)

This will often provide a more useful error message and you can sometimes figure out what went wrong by printing out the "errobj":

[*] errobj

_________________
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.


Top
 Profile  
 
Offline
 Post subject:
PostPosted: Thu Aug 03, 2006 12:46 pm 

Joined:
Wed Aug 02, 2006 3:12 pm

Topics:
Posts: 2

Find User's Topics
Thanks lot for you help .I was able to run the script thru the Script-fu Console.

However I am still unsuccessful in running it from the command prompt.

On click of file -> open points to d: and i have placed test.jpg in that location.
I have also placed the jpg file in the scripts and the bin folder, it still fails to read it. Not sure which location gimp is referring??
Is there any method to determine which folder it is referring?

Just wanted to check, when I try a simple command "gimp-2.2 --help" , I do not get any output.
The gimp/bin folder is included in the "path". Is my setup rite for the batch processing?

Kindly help...Thank you


Top
 Profile  
 
Offline
 Post subject:
PostPosted: Fri Dec 01, 2006 4:19 am 

Joined:
Fri Dec 01, 2006 4:15 am

Topics:
Posts: 3

Find User's Topics
Does anyone have a solution for this?

I've been trying for hours to use the command-line under WinXP but even something as simple as the following just hangs:
gimp.exe --help

_________________
Dragonfly 36


Top
 Profile  
 
Offline
 Post subject:
PostPosted: Fri Dec 01, 2006 4:53 am 

Joined:
Fri Dec 01, 2006 4:15 am

Topics:
Posts: 3

Find User's Topics
PROBLEM SOLVED! :h:

I've got my batch script working. But there is no output at the console (--verbose isn't working).

The trouble with the Windows console is just the quotes and slashes. So instead of:
Code:
gimp-2.2.exe -d -f -i -b --verbose '(my-gaus "C:\test.bmp" "C:\test_out.bmp")' '(gimp-quit 0)'

use
Code:
gimp-2.2.exe -d -f -i -b --verbose "(my-gaus \"C:/test.bmp\" \"C:/test_out.bmp\")" "(gimp-quit 0)"


Thanks to all for this thread. Without it the penny would've taken longer to drop.

_________________
Dragonfly 36


Top
 Profile  
 
Online
 Post subject:
PostPosted: Fri Dec 01, 2006 6:19 am 
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics:
Posts: 5016

Find User's Topics
Ahhh, so Windows doesn't use single-quotes (apostrophes) the same way Linux does.

I appreciate you posting your solution. This should permit a lot of people to do command line GIMPing on Windows.

_________________
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.


Top
 Profile  
 
Offline
 Post subject: Re: Running script from Windows XP command line
PostPosted: Wed Jun 25, 2008 2:36 pm 

Joined:
Wed Jun 25, 2008 2:14 pm

Topics:
Posts: 1

Find User's Topics
To run the second batch script found on http://www.gimp.org/tutorials/Basic_Batch/ this command worked for me.

Code:
gimp-2.4.exe -i -b "(batch-unsharp-mask \"C:\\gimpbatchtest\\*.bmp\" 25 2.5 0)" -b "(gimp-quit 0)"

Forward slashes only worked when the images were located in the system drive (ie C:/*.bmp) when the images were placed in a directory I had to escape the backslashes.

Hope this helps someone.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 10 posts ] 



Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB