Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use script-fu for loading images stored in files?
#1
I am trying to manipulate images stored in files.
As a first exercise, I tried to open an image, and then save it to a file 
with another name. Note both the source and the destination files already 
exist in the file system before my manipulation. I do not mind overwriting 
the contents of the destination file.
The code I have tried is:
Code:
(script-fu-register
   "copy"             ;func name
   "copy"             ;func label
   "Copy a file containing an image to another file. Both file exist in the file system. The destination file will be overwritten."                ;description
   ""                 ;author
   ""                 ;copyright notice
   ""                 ;date created
   ""                 ;image type that the script works on
   SF-FILENAME    "Input file"     ""
   SF-FILENAME    "Output file"    ""
)
(script-fu-menu-register "copy" "<Image>/Image/Transform/")

(define (copy inImgFile outImgFile)
   (let* (
              (image (car (gimp-file-load
                           RUN-INTERACTIVE
                           inImgFile
                          )
                     )
              )
             (gimp-file-save
               RUN-INTERACTIVE
               image
               outImgFile
               %NULL
              )
         )  
   )
)
When running this code, I am prompted to choose the input and output files. There also seems to be a brief
message at the bottom of the screen about one of gimp-file-load or gimp-file-save. Other then that, nothing
happens. In particular, nothing seems to change for the output file.
If I run gimp from the terminal, and quit gimp after running this script-fu I get (in the terminal)
Message in the terminal Wrote:INFO: a stray image seems to have been left around by a plug-in: "[name of the input file, without extension] (imported)"
What am I doing wrong?
Reply
#2
According to that message you have loaded the image successfully but you still have to display it.
Sorry that I can't help you on how to do this:  Script-Fu is like alien for me.
Reply


Forum Jump: