I just wrote my first script-fu for gimp which is supposed to save
an image in pbm format.  It works fine - except for that it saves
the image in ppm format instead of pbm format.  (The real format is
obvious from the size of the resulting file, though the file
extension is pbm).  What is going on here?  If I remove the last
line of the script and run the Save command from the menu, I get a
"proper" pbm file.

This is with gimp 2.6.12 under ubuntu 12.04.

(define (script-fu-pbm-save image) 
  (let ((nameparts (strbreakup (car (gimp-image-get-filename image)) ".")))
    (unless (and (> (length nameparts) 1)
                 (member (car (last nameparts)) '("pbm" "PBM")) )
            (set! nameparts (append (butlast nameparts) '("pbm"))) )
    (let ((filename (unbreakupstr nameparts "."))
          (layer (car (gimp-image-flatten image))) )
      (unless (= 2 (car (gimp-image-base-type image)))
        (gimp-image-convert-indexed image 0 3 FALSE FALSE TRUE ""))
      (file-pbm-save RUN-NONINTERACTIVE image layer filename filename 1))))
gimp-user-list mailing list
List address:    gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list

Reply via email to