I'm trying to write my own scripts to save a selection to a RAW file with GIMP script-fu. I found that the argument "image-type" in "file-raw-save2" expects values from { RAW_RGB (0), RAW_PLANAR (3) }. When using 3 for this argument, I got the following result: Error: Procedure execution of file-raw-save2 failed on invalid input arguments. However 0 is OK for "image-type" and the image is saved successfully. Does anyone know how to fix this? Here is some information about my system: GIMP version: 2.10.14 Operating System: Windows 10 professional v1809 Reproduction 1. Save following content as a .scm file in gimp’s script folder. (The mentioned file-raw-save2 function is in line 89.) -------------------------------------------------------------------------------------- (define (split-path path) (let* ( (ret '()) ) (for-each (lambda (part) (set! ret (append ret (strbreakup part DIR-SEPARATOR))) ) (strbreakup path DIR-SEPARATOR) ) ret ) ) (define (script-fu-compose-file-name inImage inRowIndex inColumnIndex inWidth inHeight) (let* ( (fileName "") (filePath (car (gimp-image-get-filename inImage))) (fileDir (unbreakupstr (butlast (split-path filePath)) DIR-SEPARATOR)) ) (set! fileName (string-append fileDir DIR-SEPARATOR (number->string inRowIndex) "_" (number->string inColumnIndex) "_" (number->string inWidth) "_" (number->string inHeight) ".xcf" ) ) fileName ) ) (define (script-fu-save-selection inImage inDrawable inRowIndex inColumnIndex inX inY inChunkLength inImageWidth inImageHeight) (let* ( (theWidth 0) (theWitdhExpected 0) (theHeight 0) (theHeightExpected 0) (theRAWDefaults (file-raw-get-defaults)) ) (file-raw-set-defaults 3 0) (set! theWitdhExpected (- (+ inX inChunkLength) 1)) (if (<= theWitdhExpected inImageWidth) (set! theWidth inChunkLength) (set! theWidth (- inImageWidth inX)) ) (set! theHeightExpected (- (+ inY inChunkLength) 1)) (if (<= theHeightExpected inImageHeight) (set! theHeight inChunkLength) (set! theHeight (- inImageHeight inY)) ) (gimp-image-select-rectangle inImage CHANNEL-OP-REPLACE inX inY theWidth theHeight) (gimp-edit-copy inDrawable) (let* ( (theFileName (script-fu-compose-file-name inImage inRowIndex inColumnIndex theWidth theHeight)) (theNewImage (car (gimp-edit-paste-as-new-image))) (theNewDrawable 0) ) (set! theNewDrawable (car (gimp-image-get-active-drawable theNewImage))) ; (gimp-file-save RUN-NONINTERACTIVE ; theNewImage ; theNewDrawable ; theFileName ; theFileName) (file-raw-save2 RUN-NONINTERACTIVE theNewImage theNewDrawable theFileName theFileName 3 0) (gimp-image-delete theNewImage) ) (file-raw-set-defaults (car theRAWDefaults) (cadr theRAWDefaults)) ) ) (define (script-fu-split-image inImage inDrawable inXPos inYPos inChunkLength ) (let* ( (theRowCount 0) (theColumnCount 0) (theImageWidth 0) (theImageHeight 0) (theRowIndex 0) (theColumnIndex 0) (theX 0) (theY 0) ) (set! theImageWidth (car (gimp-image-width inImage))) (set! theImageHeight (car (gimp-image-height inImage))) (set! theRowCount (/ theImageHeight (- inChunkLength 1))) (set! theColumnCount (/ theImageWidth (- inChunkLength 1))) (while (<= theRowIndex theRowCount) (set! theY (+ (* theRowIndex (- inChunkLength 1)) inYPos)) (if (< theY (- theImageHeight 1)) (begin (set! theColumnIndex 0) (while (<= theColumnIndex theColumnCount) (set! theX (+ (* theColumnIndex (- inChunkLength 1)) inXPos)) (if (< theX (- theImageWidth 1)) (script-fu-save-selection inImage inDrawable theRowIndex theColumnIndex theX theY inChunkLength theImageWidth theImageHeight) ) (set! theColumnIndex (+ theColumnIndex 1)) ) ) ) (set! theRowIndex (+ theRowIndex 1)) ) ) ) (script-fu-register "script-fu-split-image" ;func name "Split Image" ;menu label "Split image at top left point with length." ;description "XXXXXX" ;author "copyright XXX, 2019, XXXXXX" ;copyright notice "December 28, 2019" ;date created "RGB* GRAY*" ;image type that the script works on SF-IMAGE "Image to Split" 0 SF-DRAWABLE "Drawable to Split" 0 SF-VALUE _"X Position" "0" SF-VALUE _"Y Position" "0" SF-VALUE _"Chunk Length" "513" ) (script-fu-menu-register "script-fu-split-image" "<Image>/Filters/Web") --------------------------------------------------------------------------------------- 2. Open an image with GIMP. 3. Select from menu “Filters” -> “Web” -> “Split Image”. 4. Click the OK button on the dialog, and you can find the error message from GIMP’s Error Console: Split Image Warning Error while executing script-fu-split-image: Error: Procedure execution of file-raw-save2 failed on invalid input arguments. _______________________________________________ gimp-developer-list mailing list List address: gimp-developer-list@xxxxxxxxx List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list List archives: https://mail.gnome.org/archives/gimp-developer-list