I’d dare to say that this man gotten farther than any of us (that aren’t the developers of the backend of G’MIC) at the very beginning. Congratulations indeed. He’s like what I am at 6 months now.
Ohhhh boy. Back in the day. Developing Kodak Ektachrome 64 35 mm film by the E4 process. Cutting and putting the just-developed strips in the plastic sleeves and — with baited breath! — dropping the same on the light box and seeing what developed. Literally. If you think coding G’MIC is exasperating, you haven’t lived.
Having much fun seeing where you are taking this, Helmut.
EDIT:
That’s the key. Nothing fixes G’MIC in your head better than experiment after experiment…
No. 4758482.
OK, one more question… or two, or so:
- I am creating the individual negative strips above and write them into files named out…
- How can I read all these files in a subsequent step and then vertically append, say, 7 of them and output the these 7 into a new file called final…, then the next 7 and so. Of course, at the end, it might be less than 7? Probably like reading the files…
$=arg repeat $# { files 3,${arg{1+$>}} files.=$sep${} sep=, }
? - Can I remove the interim files, called out…, from within the script?
This will be a cool script once completed…
Consider store to an image storage variable, then subsequent -input
of that variable later. This is in-memory storage, but off the image list. stored
images may be reintroduced to the image list via -input
, using the image storage variable as an argument.
If you are tight for memory, can do a similar trick by writing out images in .cimgz format. This is G’MIC’s native format and essentially puts (parts of) the image list on disk See Input/Output Properties. Here, instead of storing
, you are employing the conventional output
command instead. Same effect. You are shuffling off parts of the image list for later re-insertion in someplace more convenient later.
Hope this helps.
Thanks, @grosgood. I will have a look at it. I probably need to store them on disk as there might be too many large stripes produced…
Yes, you can use rm for this, as soon as you don’t need the file anymore (won’t be deleted from disk, only removed from memory). You probably will need to remove an image just after appending it to another, for example.
Or maybe you want to delete them drom disk?
You said the magic word. Use the -append command in one of the axial directions, x
, y
, z
, c
…
It is also the opposite command to -split
I want to remove them from disk.
You can launch subprocess shells using the -exec (shortcut x
). Something like:
x "rm foobar.png"
Blimey, … I was searching the documentation foe the keyword “remove”…
But will this need to be adapted for every OS then?
That’s the downside. The upside is that exec
permits you to do all kinds of shell work, so long as you are not exporting the script for general use across different operating systems.
Yes, I’ve spend days on thie command list page. Actually, I think i’m starting to write a script each time I find some command I didn’t know yet.
And some may appear out of nowhere too!
What about delete
then? Documentation doesn’t tell much, but I guess it will work accross all systems?
I tried the delete
and it did not delete anything. But the exec
command worked (and if it did… would it support wildcrards…?)
That is correct. Use delete
for O/S independence, and because you specifically wish to clean up disk files from within G’MIC. Use exec
for calling (likely O/S dependent) shell commands from within G’MIC. If you want to use exec
in ways where you choose O/S specific scripts, you can query about your platform through the substitution variable $_os
:
$ gmic run 'echo $_os'
[gmic]./ Start G'MIC interpreter (v.3.3.0).
linux
[gmic]./ End G'MIC interpreter.
and then `exec` an external script that is compatible to the O/S identifier that comes back. (and you would write as many versions of that script for each of the O/S's that you want to support).
It works for me. Might be a problem with the path or the filename?
Seems that wildcards is not something delete
knows about. Getting rid of cabstract.mp4
…
$ ls
cabstract.mp4 cmd.txt tvfritz.gmic
$ gmic run 'delete "cab*"'
[gmic]./ Start G'MIC interpreter (v.3.3.0).
[gmic]./run/__run/ Delete file 'cab*' (1 file).
[gmic]./ End G'MIC interpreter.
$ ls
cabstract.mp4 cmd.txt tvfritz.gmic
$ gmic run 'x \"rm cab*\"'
[gmic]./ Start G'MIC interpreter (v.3.3.0).
[gmic]./run/__run/ Execute external command 'rm cab*' in verbose mode.
[gmic]./ End G'MIC interpreter.
$ ls
cmd.txt tvfritz.gmic
$