RSS/Atom feed Twitter
Site is read-only, email is disabled

batch script help

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

11 of 12 messages available
Toggle history

Please log in to manage your subscriptions.

batch script help jeremy jozwik 13 Sep 17:47
  batch script help Jay Smith 13 Sep 17:56
  batch script help saulgoode@flashingtwelve.brickfilms.com 14 Sep 03:10
   batch script help jeremy jozwik 14 Sep 03:23
    batch script help jeremy jozwik 14 Sep 07:12
     batch script help jeremy jozwik 14 Sep 09:58
      batch script help David Hodson 14 Sep 15:15
       batch script help jeremy jozwik 14 Sep 16:25
  batch script help Sven Neumann 14 Sep 18:27
   batch script help jeremy jozwik 14 Sep 19:20
AANLkTi=p5YLp7vgd-NQQysoVzt... 07 Oct 20:21
  batch script help jeremy jozwik 15 Sep 22:54
jeremy jozwik
2010-09-13 17:47:52 UTC (over 14 years ago)

batch script help

hello list, just added my self so i hope this is an active list.

im am attempting to batch compress OSM tile images. they are of png format, otherwise i would have used cjpeg. anyhow the script need only open the images in a folder and save them out with a different compression level [9]

after reading the [1] batch mode page i have assembled this format: (define (png-compress filename
compression) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist))
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (gimp-file-png-save RUN-NONINTERACTIVE image drawable filename filename))
(gimp-image-delete image)) (set! filelist (cdr filelist)))))

and run: $ gimp -i -b '(png-compress "*.png" 9)' -b '(gimp-quit 0)'

but i get: batch command: experienced an execution error.

got to say i really dont understand scripting all that much, i just really need to compress these files. thanks to anyone who can help me out here

[1] http://www.gimp.org/tutorials/Basic_Batch/

Jay Smith
2010-09-13 17:56:30 UTC (over 14 years ago)

batch script help

On 09/13/2010 11:47 AM, jeremy jozwik wrote:

hello list, just added my self so i hope this is an active list.

im am attempting to batch compress OSM tile images. they are of png format, otherwise i would have used cjpeg. anyhow the script need only open the images in a folder and save them out with a different compression level [9]

<<< snip >>>

Jeremy,

It seems to me that using Gimp for this task is perhaps not the best use of Gimp or of your time. I do not know the specific answer to your question about the problem you are encountering, but perhaps a program such as ImageMagick

http://www.imagemagick.org/script/index.php

would be more suitable. ImageMagick is specifically designed to do the kind of batch tasks that I believe I understand you wish to accomplish. We use it to process tens of thousands of images (making multiple sizes of JPEGs from TIFFs), but I don't have any specific experience with the task you are attempting.

Jay

saulgoode@flashingtwelve.brickfilms.com
2010-09-14 03:10:34 UTC (over 14 years ago)

batch script help

Quoting jeremy jozwik :

hello list, just added my self so i hope this is an active list.

im am attempting to batch compress OSM tile images. they are of png format, otherwise i would have used cjpeg. anyhow the script need only open the images in a folder and save them out with a different compression level [9]

after reading the [1] batch mode page i have assembled this format: :
:
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (gimp-file-png-save RUN-NONINTERACTIVE image drawable filename filename))
:
:

You need to define 'drawable'. Basically, you omitted a line from the script in the tutorial.

Also, the function to save a PNG file is 'file-png-save', or 'file-png-save2' (not 'gimp-file-png-save'), and has several additional parameters that need to be specified if you are to change the compression. Use the PDB Browser under the Help Menu for more information on these parameters.

Try substituting the following for the 'gimp-file-save-png' line in your script:

(file-png-save RUN-NONINTERACTIVE image
drawable
filename
filename
FALSE ; interlace (mostly for Web usage) 9 ; compression (0-9) FALSE ; bkgd (mostly for Web usage) FALSE ; gama (may be desirable for Macs targets) FALSE ; offs (useful for page layout targets) FALSE ; phys (useful for printing targets) FALSE) ; time

and run:
$ gimp -i -b '(png-compress "*.png" 9)' -b '(gimp-quit 0)'

Hopefully you are not using Windows when you run this.

jeremy jozwik
2010-09-14 03:23:56 UTC (over 14 years ago)

batch script help

On Mon, Sep 13, 2010 at 6:10 PM,
wrote:

You need to define 'drawable'. Basically, you omitted a line from the script in the tutorial.

Also, the function to save a PNG file is 'file-png-save', or 'file-png-save2' (not 'gimp-file-png-save'), and has several additional parameters that need to be specified if you are to change the compression. Use the PDB Browser under the Help Menu for more information on these parameters.

and run:
$ gimp -i -b '(png-compress "*.png" 9)' -b '(gimp-quit 0)'

Hopefully you are not using Windows when you run this.

yes the drawable part was omitted because i thought it had to do with the tutorial applying the unshapen mask. in my mind i thought this was nessisary to edit the image. and that was not what i am doing.

file-... and gimp-file-... i for some reason thought it needed a gimp command prior to the actual command. misunderstanding again

no windows box, debian.

ill attempt the script again in about 2 hours when i get home. thanks

jeremy jozwik
2010-09-14 07:12:00 UTC (over 14 years ago)

batch script help

On Mon, Sep 13, 2010 at 6:23 PM, jeremy jozwik wrote:

hmmm...

$ gimp -i -b '(png-compress "*.png" 9)' -b '(gimp-quit 0)' script-fu-Warning: Error while executing (load "/home/po/.gimp-2.4/scripts/png-compress.scm")

Error: eval: unbound variable: pattern

script-fu-Warning: Error while executing (load "/home/po/.gimp-2.4/scripts/png-compress.scm")

Error: eval: unbound variable: pattern

batch command: executed successfully. script-fu-Warning: Error while executing (load "/home/po/.gimp-2.4/scripts/png-compress.scm")

Error: eval: unbound variable: pattern

(define (png-compress filename compression)) (let* (filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist)))
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (file-png-save RUN-NONINTERACTIVE image
drawable
filename
filename
FALSE ; interlace (mostly for Web usage) 9 ; compression (0-9) FALSE ; bkgd (mostly for Web usage) FALSE ; gama (may be desirable for Macs targets) FALSE ; offs (useful for page layout targets) FALSE ; phys (useful for printing targets) FALSE) ; time (gimp-image-delete image)) (set! filelist (cdr filelist)))

jeremy jozwik
2010-09-14 09:58:02 UTC (over 14 years ago)

batch script help

On Mon, Sep 13, 2010 at 10:12 PM, jeremy jozwik wrote:

also, imagemagick i can get to work, but not much a reduction. png crush squises the files a bit better but i dont know how to command line script a folder for compression.

anything on the gimp front?

David Hodson
2010-09-14 15:15:52 UTC (over 14 years ago)

batch script help

anything on the gimp front?

Google "gimp batch process". Five of the first six hits point to David's Batch Processor plugin.

-- David

jeremy jozwik
2010-09-14 16:25:33 UTC (over 14 years ago)

batch script help

On Tue, Sep 14, 2010 at 6:15 AM, David Hodson wrote:

Google "gimp batch process". Five of the first six hits point to David's Batch Processor plugin.

oh thank god. this looks much like photoshops actions. if it works the same way this is a fantastic bit of information for me.

thank you

Sven Neumann
2010-09-14 18:27:32 UTC (over 14 years ago)

batch script help

On Mon, 2010-09-13 at 08:47 -0700, jeremy jozwik wrote:

hello list, just added my self so i hope this is an active list.

im am attempting to batch compress OSM tile images. they are of png format, otherwise i would have used cjpeg. anyhow the script need only open the images in a folder and save them out with a different compression level [9]

after reading the [1] batch mode page i have assembled this format: (define (png-compress filename
compression) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist))
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (gimp-file-png-save RUN-NONINTERACTIVE image drawable filename filename))
(gimp-image-delete image)) (set! filelist (cdr filelist)))))

You never assign the drawable variable. Try to use (drawable (car (gimp-image-get-active-drawable image)))

Not sure if that's the only problem though.

Sven

jeremy jozwik
2010-09-14 19:20:59 UTC (over 14 years ago)

batch script help

On Tue, Sep 14, 2010 at 9:27 AM, Sven Neumann wrote:

You never assign the drawable variable. Try to use  (drawable (car (gimp-image-get-active-drawable image)))

yourgh! sorry, only half brained working on this last night. late night at work...

jeremy jozwik
2010-09-15 22:54:33 UTC (over 14 years ago)

batch script help

On Wed, Sep 15, 2010 at 1:03 PM, Tetsuya YUASA wrote:

thank you sven and tetsuya, but i have gone with David's Batch Processor and it is working well.

maybe ill try scripting later.