It is currently Sun Jun 30, 2024 5:58 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Sun Mar 07, 2021 2:17 pm  (#1) 
Offline
GimpChat Member

Joined: May 25, 2013
Posts: 5
Hello!

I recently tried my camera on a night shot (in the middle of a snow storm) and ... let's just say the footage was atrocious. I got the green pixel servings of death LOL
To salvage the result I extracted all the images as individual .PNG files (with the VLC player) and decided to go the G'MIC command line way with the following batchfile :
Note: There's 240 pictures in all
@Echo off
FOR /f "tokens=*" %%G IN ('dir IN\*.png /b') DO (call :subroutine "%%G")
Pause
GOTO :eof

:subroutine
gmic -input IN/%1 fx_dreamsmooth 3,0,1,0.8,0,0.8,4,24,0 jl_colorgrading 0.127,-3,1,1,-10,-15,50,10,0,0,1,0.442,0,0,70,0,0,0,0,0,70,180,0,1.092,0,10,0 -output OUT/%1

GOTO :eof

This code passes every file from the IN\ folder, does a few G'MIC operations and then saves the result (with the same name) into the OUT\ folder

This works great ... until you have 5-6 operations and then the command line is too big to be processed.
I think I've read the whole damn manual and I'm only finding partial answers and no solutions. :gaah

I'm trying to find :
- A way to bypass the command line length limitation?
And/ or
- A way to import a script file into G'MIC --> gmic @scriptfile.txt
And / or
- A way to create a G'MIC script that will load all the pictures in sequence and do all the operations I require

I don't really want to create a custom filter unless I don't have a choice (it's not meant to be part of a GUI or whatnot).
I'd rather do all the processing in one shot instead of calling G'MIC multiple times (I "preview" the operations in GIMP so they can be processed linearly using only G'MIC)
Each filename is padded with zeros so that's to be considered if we ask G'MIC to load files sequentially (scene00001.png, scene00002.png, scene00003.png, etc).

Any help will be really appreciated!
I might also post a link to the final video if I can get this to work ;)

I'm using G'MIC CLI 2.9.6


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Sun Mar 07, 2021 4:28 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Welcome to Gimp Chat ObiWanCeleri. Possibly this tutorial could help.
How To Run A GMIC Filter On Hundreds Or Thousands Of Layers

With this method you can run the G'MIC commands after each other so your computer never chokes on too much data.


Top
 Post subject: Re: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Sun Mar 07, 2021 10:13 pm  (#3) 
Offline
GimpChat Member

Joined: May 25, 2013
Posts: 5
Interesting! Thanks!
I've also found out you could get a huge helpfile by doing the following command line:
gmic -help > help.txt


Another thing I will investigate is if I can use a video file as an input file and output individual .PNG files.

I'm going to do some more reading me thinks :)


Top
 Post subject: Re: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Sun Mar 07, 2021 10:48 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
video to frames or PNG's is easy with ffmpeg.
ffmpeg -i input.mp4 -vf fps=24 file%d.png


Top
 Post subject: Re: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Mon Mar 08, 2021 2:58 am  (#5) 
Offline
GimpChat Member

Joined: May 25, 2013
Posts: 5
Thanks for your help Tas_mania; I've found my culprit (should have read the error messages LOL)
So cut and pasting from the G'MIC plugin in Gimp gave me the following command:
fx_morphological 1,2,5,"1,0,1; 0,1,0; 1,0,1",0,0,34,0,0,50,50


Feeding that into GMIC (on a Windows command line) spits our error $4. I had a hunch the GMIC interpreter didn't like quotation marks (...)
So you need to escape them (with a backslash) for the script to work:
fx_morphological 1,2,5,\"1,0,1; 0,1,0; 1,0,1\",0,0,34,0,0,50,50


I also was wrong about the limit for a line in Window's command prompt. It's 8191 characters.
So I have lots of space to make complex commands, so long as you don't expect to see a nice layed out batch file.

Will upload the original and final result tomorrow to give you guys an idea of the results.


Top
 Post subject: Re: Newbie alert: loading numbered files for G'MIC transformation
PostPosted: Mon Mar 08, 2021 3:02 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Good on you ObiWanCeleri. I'm sure some Windows G'MIC users will use that escape sequence. :bigthup


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Image transformation to a circular arc

11

No new posts Attachment(s) Alert: Potential security risk ahead

5

No new posts GIMP - my security software prevents it from loading - RESOLVED

6

No new posts Attachment(s) Font In Status Bar Not Loading Correctly (on top of other font issues)

4

No new posts Script writer newbie

3



* Login  



Powered by phpBB3 © phpBB Group