2015年3月25日 星期三

Linux Gimp Script from bmp to SGI (*.rgb)

bmp2rgb

#!/bin/bash
{
cat <<EOF
(define
(bmp-sgi
  input
output
)
(let*
  (
(image
  (car
(gimp-file-load
RUN-NONINTERACTIVE
input
input
)
)
)
(drawable
  (car
  (gimp-image-get-active-drawable
image
)
)
)
)
(gimp-image-flatten
  image
)
(let*
  (
  (newdrawable
(car
  (gimp-image-get-active-drawable
image
)
)
  )
)
(file-sgi-save
RUN-NONINTERACTIVE
image
newdrawable
output
output
0
)
)
)
)
EOF

for i in *.bmp; do
  echo "(gimp-message \"$i\")"
  echo "(bmp-sgi \"$i\" \"${i%%.bmp}.rgb\")"
done

echo "(gimp-quit 0)"
} | gimp -i -b -

最重要的是file-sgi-save這個函式
有六個參數 要填對

沒有留言:

張貼留言