I write follow script (convert bitmap images to join layer to distribute
animated gif file)

But I'm in stagnation. Console display only `ERROR: bad function' and
other no hint.

-- 
(define (bmp_to_gifani directory transparent-color ms-per-frame)
  (let* (
      (filelist (cadr (file-glob (string-append directory "\\*") 1)))
      (image (car (gimp-image-new 8 8 RGB)))
      (count 0)
    )
    (gimp-display-new image)
    (while filelist
      (let* (
          (bmp-filepath (car filelist))
          (bmp-image (car (gimp-file-load
            RUN-NONINTERACTIVE  
            bmp-filepath
            bmp-filepath)))
          (layer
            (car (gimp-layer-new-from-drawable
              (car (gimp-image-get-active-layer bmp-image))
              image)))
        )
        (gimp-layer-set-offsets layer 0 0)
        (gimp-image-add-layer image layer 0)
        (gimp-image-resize-to-layers image)

        (gimp-drawable-set-name layer
          (string-append
            (number->string count)
            " (" (number->string ms-per-frame) "ms)(replace)"))

        (gimp-by-color-select layer transparent-color 2 FALSE 0 0 0 0)
        (gimp-edit-cut layer)

        (set! count (+ count 1))
        (set! filelist (cdr filelist))
      )
    )

    (if (< 0 count) (
      (print image) ;; print
      (gimp-image-convert-indexed image 0 0 255 FALSE TRUE "")
      (print image) ;; not print
      ;;(print image)
      ;;(set! image (car (plug-in-animationoptimize RUN-NONINTERACTIVE
image image)))
      ;;(print directory)
      ;;(set! savepath (string-append directory ".gif"))
      ;;(print savepath)
      ;;(file-gif-save RUN-NONINTERACTIVE image image savepath savepath
0 1 ms-per-frame 2)
      ;;(print 5)
    ))
  )
)
--
- local environment
  c:\foo\1.bmp, c:\foo\2.bmp, c:\foo\3.bmp

and execute in console
  (bmp_to_gifani "c:" '(0 0 0) 50)

to display
  ERROR: bad function.

Stop in call (gimp-image-convert-indexed). How to invoke this method and
debug this situation?

Please hint me.
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to