It is currently Thu Jun 11, 2026 10:14 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Wed Dec 30, 2015 11:30 am  (#21) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
kobyakov wrote:
I changed procedure names according to the gimp error messages, ...

Can you post the error messages you receive?

kobyakov wrote:
saulgoode: I changed procedure names, the script goes through files in directory.
But when it comes to the last file it writes "No image available for sequential edit" and leave the image as is - it does not save it and close. one should manually do it - hit some keys and finalize the sequence.

There should only be files left open when you are finished if there were files open before running the script or if there has been an error which occurred while trying to save the file.

kobyakov wrote:
Could you fix it?

I don't have the development version available on my machine at the moment and don't really plan to update my scripts until it can be done against a stable code base.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Wed Dec 30, 2015 12:38 pm  (#22) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
The idea was to went through a bunch of *.xcf images in folder. No matter what the filenames are, we are looking only for the same the extension.

In my workflow the images are named yyy-mm-dd_hh-mm-ss_number.xcf, as usual the "number"'s are not sequential. So the plugin says "No successor found for <filename>". Looks like the plugin is useful only when we have images with ordered filenames.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Wed Dec 30, 2015 3:56 pm  (#23) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
kobyakov wrote:
The idea was to went through a bunch of *.xcf images in folder. No matter what the filenames are, we are looking only for the same the extension.

In my workflow the images are named yyy-mm-dd_hh-mm-ss_number.xcf, as usual the "number"'s are not sequential. So the plugin says "No successor found for <filename>". Looks like the plugin is useful only when we have images with ordered filenames.


Matter of heuristics... What would be the criteria to find the "next" file? If my script works for you and regular numbered file names on 2.9, it's not hard to make a derivative to support your file name convention.

_________________
Image


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 4:29 am  (#24) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
it's not heuristics, it is just my situation.

it's not about criteria how to find the next file, the idea was to make through all files in directory, no matter what the filenames are. the order in which the files will be open is not important, the critical thing is to not skip any single one and be sure that we make through all of them.

It is all just about to quickly make some tasks on a bunch of files in directory, avoiding unnecessary hitting ctrl+w, ctrl+o, marking the next file and avoid probability of skipping one or some files in rush.

Rob made a good script which I used almost everyday. But now 8-bit editing in stable Gimp is too limiting in my work, so I had to switch to unstable version.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 4:36 am  (#25) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
saulgoode wrote:
Can you post the error messages you receive?


Looks like the syntax was changed

Gimp 2.8 --> Gimp 2.9
gimp-parasite-find --> gimp-get-parasite
gimp-parasite-attach --> gimp-attach-parasite
etc...


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 5:07 am  (#26) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
kobyakov wrote:
Looks like the syntax was changed

Gimp 2.8 --> Gimp 2.9
gimp-parasite-find --> gimp-get-parasite
gimp-parasite-attach --> gimp-attach-parasite
etc...

Apparently you missed my suggestion to:

Try running GIMP using the --pdb-compat-mode on switch.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 7:18 am  (#27) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
man, I tried it )

error message appear "--pdb-compat-mode=on no such file or directory"

tried to launch gimp from terminal, desktop file, tried to put "--pdb-compat-mode on" and "--pdb-compat-mode=on"... gimp just says that no such file or directory

on the other hand gimp understands --gegl-threads=4 from console and gives no error messages on that


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 8:26 am  (#28) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2603
kobyakov wrote:
Rob made a good script which I used almost everyday. But now 8-bit editing in stable Gimp is too limiting in my work, so I had to switch to unstable version.


I run a Gimp 2.9.3 in a LinuxMint

I am no coder, just a dabbler,

Got the attached sequential_processing v1.2 working.

worth a try, no guarantees, remember to unzip it


Attachments:
Sequential_processing-2-9-3.scm.zip [2.38 KiB]
Downloaded 143 times
Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 9:03 am  (#29) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
kobyakov wrote:
it's not heuristics, it is just my situation.

it's not about criteria how to find the next file, the idea was to make through all files in directory, no matter what the filenames are. the order in which the files will be open is not important, the critical thing is to not skip any single one and be sure that we make through all of them.

The scripts don't remember which files have been processed. So knowing in which order things are processed is important (anything before the current file has been done).

_________________
Image


Last edited by ofnuts on Thu Dec 31, 2015 11:49 am, edited 1 time in total.

Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Dec 31, 2015 10:52 am  (#30) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
rich2005: Thank you! Your script shows no error messages, but I have the same problem - it does not open next image. Looks like the problem is on my side since I have the same gimp version.

ofnuts: sure, the script must control the situation - i.e. remember which files were open in this session and which are not. suppose there are few ways to do this.


Happy New Year to everybody in this topic! See you next year )


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Sun Jan 03, 2016 12:38 pm  (#31) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
saulgoode wrote:
There should only be files left open when you are finished if there were files open before running the script or if there has been an error which occurred while trying to save the file.

..just think about it last week. Why there should be last file left open when the sequential run finished? Would it be easier for the operator to save and close it when he hits "save and open next"?


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Wed Jan 06, 2016 8:51 pm  (#32) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
I don't have 2.9 to try, but looking at rich2005's changes, it should work.

A few points:
- The script does not require numerically sequential filenames. It requests all the matching file extensions (case insensitive) in the directory and processes them in the order file-glob returns them.
- The "Last File in Directory" message only gets displayed when there is only the currently open image that matches the file-glob it does this by breaking apart the returned list at the file name that matches the currently open file...

How many images are in the directory?
What is the extension you are trying to work it on?

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Jan 07, 2016 4:13 am  (#33) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
the script with new syntax:
; sequential_processing.scm
; by Rob Antonishen
; http://silent9.com

; Version 1.2 (20120802)

; Description:
; Written to answer this request:
; There a directory with few tenth of a *.xcf images, and the operator opens them one by one starting
; from the first image (and doing some stuff on them between the closing and opening the images).
; The sequence I want to automate is:
; 1. save current image
; 2. close it
; 3. open next image in directory
; The question: Is there a way to automate it? If this sequence cannot be done by script, is there other ways to do it?
;
; Changes:
; v1.0 Initial release
; v1.1 Name changed, added another script to select the start file rather than just a folder
; v1.2 Option to specify file types.

; License:
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; The GNU Public License is available at
; http://www.gnu.org/copyleft/gpl.html

; global defines for all scripts
(define seq-file-list-ext (list "xcf" "jpg" "bmp" "png" "tiff" "orf"))
(define seq-file-list-glob (list "[xX][cC][fF]" "[jJ][pP][gG]" "[bB][mM][pP]" "[pP][nN][gG]" "[tT][iI][fF][fF]" "[oO][rR][fF]"))

(define (seq-open-first-file inDir inType)
(let*
((fileexts (list-ref seq-file-list-glob inType))
(fileext (list-ref seq-file-list-ext inType))
(filelist (cadr (file-glob (string-append inDir DIR-SEPARATOR "*." fileexts) 1)))
(img -1)
(disp -1)
(parasite())
)
(if (= (length filelist) 0)
(gimp-message (string-append "No " fileext " files in this directory!"))
(begin
(set! img (car (gimp-file-load RUN-NONINTERACTIVE (car filelist) (car filelist))))
(set! disp (number->string (car (gimp-display-new img))))
(set! parasite (list "display-number" 1 disp))
;set parasite in image so the display can be closed later
(gimp-image-attach-parasite img parasite)
;global parasite for sequential file type
(set! parasite (list "seq-file-type" 1 (number->string inType)))
(gimp-attach-parasite parasite)
)
)
(gimp-progress-end)
)
)

(script-fu-register "seq-open-first-file"
"<Image>/File/Sequential/Open First File..."
"Open the first file in a directory setting up for repeated file processing"
"Rob Antonishen"
"Rob Antonishen"
"Aug 2012"
""

SF-DIRNAME "Load from" ""
SF-OPTION "File Types" seq-file-list-ext
)

(define (seq-open-specific-file inFile)
(let*
((fileType (let ((i 0) (k #f))
(for-each (lambda (n)
(if (string-ci=? n (car (last (strbreakup inFile ".")))) (set! k i))
(set! i (+ i 1))) seq-file-list-ext) k))
(fileexts (if fileType (list-ref seq-file-list-glob fileType)))
(fileext (if fileType (list-ref seq-file-list-ext fileType)))
(img -1)
(disp -1)
(parasite())
)
(if (not fileType)
(gimp-message (string-append "File must be one of: " (unbreakupstr seq-file-list-ext " ")))
(begin
(set! img (car (gimp-file-load RUN-NONINTERACTIVE inFile inFile)))

(set! disp (number->string (car (gimp-display-new img))))
(set! parasite (list "display-number" 1 disp))
;set parasite in image so the display can be closed later
(gimp-image-attach-parasite img parasite)
;global parasite for sequential file type
(set! parasite (list "seq-file-type" 1 (number->string fileType)))
(gimp-attach-parasite parasite)
(gimp-message (string-append "Sequential filetype set to " fileext))
)
)
(gimp-progress-end)
)
)

(script-fu-register "seq-open-specific-file"
"<Image>/File/Sequential/Open Specific File..."
"Opens a specific file in a directory setting up for repeated file processing of that filetype"
"Rob Antonishen"
"Rob Antonishen"
"Aug 2012"
""
SF-FILENAME "Starting File" ""
)


(define (seq-open-next-file inImg inLayer)
(let*
((filename (car (gimp-image-get-filename inImg)))
(filelist ())
(img -1)
(disp -1)
(parasite (catch #f (car (gimp-get-parasite "seq-file-type"))))
(fileexts "")
(fileext "")
(fileType -1)
)
(if (equal? filename "") ; check that file is saved already
(gimp-message "Not a saved file!")
(when parasite
; get filetype from parasite
(set! fileType (string->number (caddr parasite)))
(set! fileexts (list-ref seq-file-list-glob fileType))
(set! fileext (list-ref seq-file-list-ext fileType))

; check that the file matches the parasite file type
(if (not (string-ci=? fileext (car (last (strbreakup (car (last (strbreakup filename DIR-SEPARATOR))) ".")))))
(gimp-message (string-append "Not a " fileext " file!"))
(begin
; save current file
(gimp-file-save RUN-NONINTERACTIVE inImg inLayer filename (car (last (strbreakup filename DIR-SEPARATOR))))

; check for a display parasite and delete the display, erase the parasite and delete the image
(if (catch #f (gimp-image-get-parasite inImg "display-number"))
(gimp-display-delete (string->number (caddr (car (gimp-image-get-parasite inImg "display-number")))))
)

; get file list starting with this one
(set! filelist (member filename (cadr (file-glob (string-append (unbreakupstr (butlast (strbreakup filename DIR-SEPARATOR)) DIR-SEPARATOR) DIR-SEPARATOR "*." fileexts) 1))))
; check for more than one file in the list
(if (= (length filelist) 1)
(begin
(gimp-message (string-append "Last " fileext " file in directory!"))
;delete filetype parasite
(gimp-detach-parasite "seq-file-type")
)
(begin
; load up new file, display.
(set! img (car (gimp-file-load RUN-NONINTERACTIVE (cadr filelist) (cadr filelist))))
(set! disp (number->string (car (gimp-display-new img))))
(set! parasite (list "display-number" 1 disp))
;set parasite in image so the display can be closed later
(gimp-image-attach-parasite img parasite)
)
)
)
)
)
)
(gimp-progress-end)
)
)

(script-fu-register "seq-open-next-file"
"<Image>/File/Sequential/Save and Close then Open Next File"
"Save and close the current file then open the next file of the matching type in that directory"
"Rob Antonishen"
"Rob Antonishen"
"Aug 2012"
"*"
SF-IMAGE "image" 0
SF-DRAWABLE "drawable" 0
)

list of files in directory:
-rw-rw-r-- 1 serg serg 31133008 янв. 7 09:54 2015-05-23_16-45-55_0061.xcf
-rw-rw-r-- 1 serg serg 27671335 янв. 7 09:58 2015-05-23_16-55-08_0117.xcf
-rw-rw-r-- 1 serg serg 24010596 янв. 7 09:59 2015-05-23_17-09-25_0238.xcf
-rw-rw-r-- 1 serg serg 28930165 янв. 7 10:00 2015-08-06_17-12-52_0140.xcf
-rw-rw-r-- 1 serg serg 59392454 янв. 2 14:17 2015-08-06_17-14-45_0158.xcf
-rw-rw-r-- 1 serg serg 36416747 янв. 2 14:17 2015-08-06_17-29-07_0224.xcf
-rw-rw-r-- 1 serg serg 32403336 янв. 2 14:17 2015-08-06_17-29-07_0226.xcf
-rw-rw-r-- 1 serg serg 36634844 янв. 2 14:17 2015-08-07_16-05-20_0013.xcf
-rw-rw-r-- 1 serg serg 44260545 янв. 2 14:17 2015-08-08_14-14-38_0533.xcf
-rw-rw-r-- 1 serg serg 45718710 янв. 2 14:18 2015-08-08_14-31-20_0605.xcf
-rw-rw-r-- 1 serg serg 48831625 янв. 2 14:18 2015-08-08_14-31-25_0608.xcf
-rw-rw-r-- 1 serg serg 51261485 янв. 2 14:18 2015-08-08_14-43-25_0764.xcf
-rw-rw-r-- 1 serg serg 83063320 янв. 2 14:18 2015-12-27_15-32-47_0042.xcf
-rw-rw-r-- 1 serg serg 78191388 янв. 2 14:18 2015-12-27_15-34-40_0050.xcf
-rw-rw-r-- 1 serg serg 96298636 янв. 2 14:18 2015-12-27_15-47-25_0060.xcf
-rw-rw-r-- 1 serg serg 86020045 янв. 2 14:18 2015-12-27_16-19-15_0084.xcf

The script opens first file but after invoke "save and open next" it says that no xcf files to open...

I really don't know what is the problem. Maybe it is not only syntax is changed but parameters type etc...

I tried to trace the filelist variable via gimp-message but i do not know how to do it. If you send me script with debug capabilities I can test it.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Jan 07, 2016 6:11 am  (#34) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2603
Is it some sort of language - locale - issue.?

I do not normally have spaces in any filename (nasty windows thing :) ) but as a try
(so problem is not the spaces)

A series of screen shots, originally in png format resaved as xcf in Gimp 2.9

Cycles though without problem, image changed or not changed, no difference. (so not the new xcf format)

I have been using an extra (more convenient) scripts folder but putting the script in the default Gimp 2.9 folder

~/.config/GIMP/2.9/scripts/ (so not the script location)

cant think of anything else

screenshot http://i.imgur.com/aMPLqcU.jpg


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Jan 07, 2016 9:36 am  (#35) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
kobyakov wrote:
The script opens first file but after invoke "save and open next" it says that no xcf files to open...

The message "no xcf files to open" suggests that you are NOT invoking "save and open next", but instead running "open first file" a second time. ("Save and open next" would produce the message "Last xcf file in directory".)

More precise descriptions of your actions, along with reporting of the exact text contained in error messages, should prove quite beneficial to those trying to replicate your problem.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Thu Jan 07, 2016 11:43 am  (#36) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
saulgoode: OK, I'll be more precise. the message is "Last xcf file in directory!" it appears as message in gimp tray (tray? don't know what is the name of the lowest bar in the gimp's window), not as dialog. Actually, my last two messages was about Rob's script.

rich2005: interesting idea. i install lubuntu 15.10 recently along with unstable gimp. I'll check the script on my laptop with old lubuntu 14.04 and stable and unstable gimps - hope that would help to locate the problem.

Another peculiarity - each new script call (Open first file...) opens different images - not the same one. Don't know if it matters...


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Fri Jan 08, 2016 3:23 am  (#37) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
Rob's script works well on my laptop with lubuntu 14.04 and Gimp 2.9.3

The problems are on machine with lubuntu 15.10. It is not locale problem since locales are the same on both machines (and was configured in same manner).

saul's script works on both machines.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Fri Jan 08, 2016 9:10 pm  (#38) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
kobyakov wrote:
Another peculiarity - each new script call (Open first file...) opens different images - not the same one. Don't know if it matters...


That would mean that the file glob is returning a different ordered list each time it is called. Odd.

Can you open the script-fu console (Filters->Script-fu->Console) and type in this:
(cadr (file-glob (string-append "/home/rob/*.[xX][cC][fF]") 1))


replacing /home/rob/ with the path to your files....

Every time this is called it should return a list of all the files that match, in the same order, every time.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Sat Jan 09, 2016 5:15 am  (#39) 
Offline
GimpChat Member

Joined: Jul 31, 2012
Posts: 22
> (cadr (file-glob (string-append "/home/serg/Postprod/297/*.[xX][cC][fF]") 1))
("/home/serg/Postprod/297/2015-12-27_15-47-25_0060.xcf" "/home/serg/Postprod/297/2015-12-27_16-19-15_0084.xcf" "/home/serg/Postprod/297/2015-05-23_16-45-55_0061.xcf" "/home/serg/Postprod/297/2015-05-23_16-55-08_0117.xcf" "/home/serg/Postprod/297/2015-05-23_17-09-25_0238.xcf" "/home/serg/Postprod/297/2015-08-06_17-12-52_0140.xcf" "/home/serg/Postprod/297/2015-08-06_17-14-45_0158.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0224.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0226.xcf" "/home/serg/Postprod/297/2015-08-07_16-05-20_0013.xcf" "/home/serg/Postprod/297/2015-08-08_14-14-38_0533.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-20_0605.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-25_0608.xcf" "/home/serg/Postprod/297/2015-08-08_14-43-25_0764.xcf" "/home/serg/Postprod/297/2015-12-27_15-32-47_0042.xcf" "/home/serg/Postprod/297/2015-12-27_15-34-40_0050.xcf")
> (cadr (file-glob (string-append "/home/serg/Postprod/297/*.[xX][cC][fF]") 1))
("/home/serg/Postprod/297/2015-12-27_15-47-25_0060.xcf" "/home/serg/Postprod/297/2015-12-27_16-19-15_0084.xcf" "/home/serg/Postprod/297/2015-05-23_16-45-55_0061.xcf" "/home/serg/Postprod/297/2015-05-23_16-55-08_0117.xcf" "/home/serg/Postprod/297/2015-05-23_17-09-25_0238.xcf" "/home/serg/Postprod/297/2015-08-06_17-12-52_0140.xcf" "/home/serg/Postprod/297/2015-08-06_17-14-45_0158.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0224.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0226.xcf" "/home/serg/Postprod/297/2015-08-07_16-05-20_0013.xcf" "/home/serg/Postprod/297/2015-08-08_14-14-38_0533.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-20_0605.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-25_0608.xcf" "/home/serg/Postprod/297/2015-08-08_14-43-25_0764.xcf" "/home/serg/Postprod/297/2015-12-27_15-32-47_0042.xcf" "/home/serg/Postprod/297/2015-12-27_15-34-40_0050.xcf")
> (cadr (file-glob (string-append "/home/serg/Postprod/297/*.[xX][cC][fF]") 1))
("/home/serg/Postprod/297/2015-12-27_15-47-25_0060.xcf" "/home/serg/Postprod/297/2015-12-27_16-19-15_0084.xcf" "/home/serg/Postprod/297/2015-05-23_16-45-55_0061.xcf" "/home/serg/Postprod/297/2015-05-23_16-55-08_0117.xcf" "/home/serg/Postprod/297/2015-05-23_17-09-25_0238.xcf" "/home/serg/Postprod/297/2015-08-06_17-12-52_0140.xcf" "/home/serg/Postprod/297/2015-08-06_17-14-45_0158.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0224.xcf" "/home/serg/Postprod/297/2015-08-06_17-29-07_0226.xcf" "/home/serg/Postprod/297/2015-08-07_16-05-20_0013.xcf" "/home/serg/Postprod/297/2015-08-08_14-14-38_0533.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-20_0605.xcf" "/home/serg/Postprod/297/2015-08-08_14-31-25_0608.xcf" "/home/serg/Postprod/297/2015-08-08_14-43-25_0764.xcf" "/home/serg/Postprod/297/2015-12-27_15-32-47_0042.xcf" "/home/serg/Postprod/297/2015-12-27_15-34-40_0050.xcf")


I do not take it as a kind of problem. The principal thing is - to get through files in directory and don't skip any one. If they would come up in order or mixed randomly - it does not make any difference to retoucher whose aim is to make just single operation on each file.

In fact, I noticed that previously (with stable gimp) files were opened in some kind of order (not alphabetical), don't know what it was. But each time I went through directory the sequence remains the same.

Anyway, it is not a bug in my opinion.


Top
 Post subject: Re: How to automate saving, closing and opening of images?
PostPosted: Sat Jan 09, 2016 8:19 am  (#40) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
RobA wrote:
Every time this is called it should return a list of all the files that match, in the same order, every time.

This would be dependent upon the filesystem type (reiserfs, ext4, ntfs, etc) and kernel version. And it may not hold true if your script makes any changes to the filesystem in between calls. Basically, under Linux the order that entries are retrieved from a directory is not specified, and thus not guaranteed to remain consistent when changes occur.

Your script should work if you manually sort the candidate file list each time after retrieving it. With the following 'sort' procedure defined, this can be accomplished with (sort string<? (cadr (fileglob ... .

(define (sort < lis)
      (define (dosort < lis n)
        (if (= n 1)
          (list (car lis))
          (let ((i (quotient n 2)))
            (domerge <
                     (dosort < lis i)
                     (dosort < (list-tail lis i) (- n i))))))
      (define (domerge < lis1 lis2)
        (cond
          ((null? lis1)
            lis2)
          ((null? lis2)
            lis1)
          ((< (car lis2) (car lis1))
            (cons (car lis2) (domerge < lis1 (cdr lis2) )))
          (else
            (cons (car lis1) (domerge < (cdr lis1) lis2)))))
     
      (if (null? lis)
        lis
        (dosort < lis (length lis))))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


cron

* Login  



Powered by phpBB3 © phpBB Group