Re: [Gimp-developer] filetype plug-in to get type of entity (file/directory)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings, Markus (and everyone else).

At 07:47 PM 07/16/2004, you wrote:
this is a trivial plug-in that implements one single call:

file-get-type <path>
[snip]
I'm giving this another shot (after bug #145370, taking your feedback into
account - TinyScheme currently lacks a similar feature), because it seems to
me that batch-processing is the single most often asked issue on the
comp.graphics.apps.gimp NG, and it would be great if we could just give
people a script similar to the sample I'm attaching, tell them to copy it to
~/.gimpXY/scripts/ and let's rock, without the need to download and compile a
separate plug-in.

Users of GIMP 2.0.x may find your scripts useful, Markus. It could also fill a gap in the current Script-Fu plug-in. The Tiny-Fu plug-in, while not making your work obsolete, will provide an alternative approach to batch processing.


The following code snippet (shown without the 'tiny-fu-register' block) demonstrates how a script written for Tiny-Fu would be able to handle batch-processing. When called up from the GIMP menus, you would get a dialog box where you could enter (or browse for) a directory. The script will then open up the directory and generate a list of all entries (including . and ..). With the use of the 're' extension, pattern matching could be applied to the file names and only the ones that match a supplied pattern could be listed. Once I add a 'file-type' routine to one of the extension packages, it will be possible to only list files of a given type.

(define (tiny-fu-listfiles dir)
  (let* (
        (dir-stream (open-dir-stream dir))
        (file)
        )

    (if (not dir-stream)
      (gimp-message (string-append "Unable to open directory " dir))
      (
        (do
          ( (file (read-dir-entry dir-stream) (read-dir-entry dir-stream)) )
          ( (eof-object? file) )
          (display file)
          (newline)
        )
        (close-dir-stream dir-stream)
      )
    )
  )
)

Also, the new file handling routines available allow for a file to be deleted (assuming you have the permissions necessary to do so).

When I mentioned on #gimp that a script should be written to demonstrate the new possibilities for scripts, schumaml suggested a contact sheet. Tiny-Fu makes such a script a very real possibility. I have already started to plan out how such a script should behave and the information a user would need to provide.

This is just a taste of the possibilities for scripting in GIMP using Scheme based scripts with Tiny-Fu. What would you like to do today? :-)


Cheers!

Kevin.  (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172        |"What are we going to do today, Borg?"
E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus:
Packet:ve3syb@ve3yra.#con.on.ca.na|  Try to assimilate the world!"
#include <disclaimer/favourite>   |              -Pinkutus & the Borg


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux