GIMP Script-Fu:“错误:(:1)car:参数1必须是:pair”

时间:2017-03-29 19:09:00

标签: error-handling batch-processing gimp script-fu gimpfu

我很擅长使用GIMP的脚本fu,我正在编写一个脚本来浏览.tif图像文件的完整文件夹,调整它们的大小,最大尺寸为1200像素,同时保持图像的比例。然后它将文件保存为.png文件类型。

我遇到的问题似乎无法找到答案:

  

错误:(:1)car:参数1必须是:pair

据我所知,它说我正在尝试找到没有内容的列表的第一个条目,但我没有看到任何进一步的实例,这将是一个问题。我已经在众多的网站上寻求帮助,并在一段时间内修改脚本,所以我认为是时候寻求帮助了。不幸的是,根据我的说法,GIMP的文档不是很强大。我错过了某个仍然导致此错误的汽车(或者是指现在更模糊的东西吗?)

提前致谢...

(script-fu-register 
    "batchresize"            
    "Batch Resize"                                  
    "Resizes all images in folder to the desired maximum size and saves as .png"      
    "name"                   
    "(c) 2017"
    "March 2017"           
    ""
    SF-VALUE    "Maximum Dimension" "1200"   
    SF-STRING   "Target Folder"     "/Scripts/Input/*.tif"
)

(script-fu-menu-register "batchresize" "<Image>/File/Batch"
)

(define 
    (batchresize maximum targetfolder
    )

    (let* 
        (   
            (filelist 
                (car 
                    (file-glob targetfolder 1
                    ) 
                )
            )

            (width 1200
            )   
            (height 1200
            )
        )

        (while 
            (not 
                (null? filelist
                ) 
            )

            (let* 
                (
                    (filename 
                        (car filelist
                        )
                    )

                    (image 
                        (car 
                            (gimp-file-load RUN-NONINTERACTIVE filename filename
                            )
                        )
                    )

                    (drawable 
                        (car 
                            (gimp-image-get-active-layer image
                            )
                        )
                    )
                )

                (Set! width car(gimp-image-width)
                )

                (Set! height car(gimp-image-height)
                )

                (if 
                    (> height width
                    )
                    (set! proportion 
                        (/ width height
                        ) 
                    )

                    (set! height maximum
                    )

                    (set! width 
                        (* maximum proportion
                        )
                    )

                    (if 
                        (< height width
                        )

                        (set! proportion 
                            (/ height width
                            ) 
                        )

                        (set! width maximum
                        )

                        (set! height 
                            (* maximum proportion
                            )               
                        )

                        (if 
                            (= height width
                            )

                            (set! height maximum
                            )

                            (set! width maximum
                            )
                        )

                        (gimp-image-scale-full image width height INTERPOLATION-CUBIC
                        )

                        (file-png-save RUN-NONINTERACTIVE image drawable filename filename 1 0 0 0 0 0 0 
                        )

                    )

                    (gimp-image-delete image
                    )
                )
                (set! filelist 
                    (cdr filelist
                    )
                )
            )
        )
    )
)

0 个答案:

没有答案