LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-09-2006, 02:11 AM   #1
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Need help doing batch-convert with Gimp


Hi -

I'm new to Script-Fu, Scheme and Gimp plug-ins. I'm running gimp 2.2.4 on SuSE Linux 9.3. I've been through all of the tutorials, and several days of trial-and-error, but I just can't get it to work.

I need to write a script that converts all of the *.png files in a directory from RGBA to indexed color. All of the files need to share the *same* palette, so I'm using the standard "Web" palette. It works fine manually, but I've had no luck getting the script to work.

When I run it from the command line, I get this:
Quote:
gimp -i -b '(script2-test ../../proj/hbaview/data/gimp_scaled/*.png)' '(gimp-quit 0)'
No batch interpreter specified, using the default 'plug_in_script_fu_eval'.
batch command: experienced an execution error.
When I run it from Xtns, I get this:
Quote:
(script2-test ../../proj/hbaview/data/gimp_scaled/*.png)
ERROR: unbound variable (see errobj)
The script is below. Any idea what I'm doing wrong?????

Thank you VERY much in advance!
============================================================
Code:
;
; Adapted from:
; - http://www.gimp.org/tutorials/Basic_Batch/
; - less gimpconvert_pdb.h =>
;     boolean gimp_image_convert_indexed
;       (gint32                  image_ID,
;        GimpConvertDitherType   dither_type,
;        GimpConvertPaletteType  palette_type,
;        gint                    num_cols,
;        gboolean                alpha_dither,
;        gboolean                remove_unused,
;        const gchar            *palette);
;
(define (script2-test pattern)
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while filelist
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image))))
                  (gimp-image-convert-indexed
                     image
                     FS-DITHER
                     MAKE-PALETTE
                     216
                     FALSE
                     FALSE
                     "Web"))
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist))))
(script-fu-register
  "script2-test"
  "script2-test"
  "Convert RGB to Indexed"
  ""
  ""
  "January 8, 2006"
  ""
  SF-STRING "pattern" "/../../proj/hbaview/data/gimp_scaled/*.png")

(script-fu-menu-register
  "script2-test"
  "<Toolbox>/Xtns/Script-Fu/Utils")

Last edited by paulsm4; 01-09-2006 at 02:13 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to convert .wav file into mp3 files in batch mode sparsh Linux - Software 6 11-20-2007 11:53 AM
printing on HP PhotoSmart from Gimp 2.2, gimp-print drivers needed? pearman Debian 2 08-05-2005 05:19 AM
Batch convert video files KimVette Linux - General 1 08-02-2005 10:13 PM
gimp / gutenprint prob: gimp does not print bitpicker Linux - Software 0 04-08-2005 08:38 AM
mp3 batch convert, remote from command line zerodot Linux - Networking 1 02-12-2003 06:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration