Batch coloring lineart?

Hello, I really love this plugin and am still learning all the really amazing things it can do. I was just hoping someone can help, as I’m just a little confused. Right now I am using G’Mic through Krita, and I am a little confused on how to use the command line to batch process images-- namely, where is the command line? I just don’t know where to find it. I am trying to use the interactive colors in order to batch color multiple frames of lineart animation. I also tried the BIMP plugin and couldn’t really figure out how to launch G’Mic in order to get the batch process started. Thanks so much.

UPDATE: Thanks so much for the help everyone. Was able to get GIMP plugin BIMP to work by copying and pasting the filter command into the gmic manipulation set command string input, but when using Interactive Colorize G’MIC brings up a prompt that requires input for every image, so currently trying to solve this issue. Besides that I am able to batch export using other filters, so that’s pretty nifty.

Hi @squirrel,

It sounds like you’ll need more help than I can give right now, so hopefully somebody else will comment soon. How you open the the command line will depend on which operating system you have - g’mic does not have its own terminal. You’ll probably need some patience with it once you get there too!

Thanks for the response, I know I sound a bit lost, but that actually does help me. I thought I was looking for something within G’Mic itself. Going to keep at it, maybe it’ll click. Thank you.

1 Like

@squirrel Welcome to the forum!

If you are a GUI oriented person, one way to do it is to insert an image per layer in Krita and then apply filter to all layers. This will only work on filters that require one input layer. I don’t have time to check but let me know if this idea works.

@Reptorian knows more about how Krita interacts with G’MIC.

You also mentioned BIMP. Are you using it with GIMP or Krita? (Can it even be used with Krita?)

I don’t think Krita G’MIC is designed to work with animation, but I never really even cared to bother with Krita animation feature. G’MIC in Krita process layers as different images within Krita, and with the assumption that the image are in RGBA32F(0-1) format normalized to 0-255 range.

BIMP is a plugin for GIMP to batch process image.

Maybe post this to krita-artists.org?

Multiple layers sounds promising. I can try it out and see how that goes.
The main objective is batch processing to help out some 2D animators get some flat colors done, so I’m willing to try just about anything. Any other effects would be icing on the cake. Downloaded G’Mic for Krita, Gimp, and the standalone interface. I tried to follow Processing several photos at once | paulsphotopalace and command prompt (I’m using Windows) isn’t recognizing gmic. I’m probably doing something wrong, but I’m not sure what. I was able to get BIMP working on GIMP and was able to pull up G’Mic in the list of available options but wasn’t able to figure out how to input what I wanted G’Mic to do from the BIMP interface.
Thanks so much for your help, will try out the layer solution for now and see if that works well enough for what I’m looking for.

You should watch some videos from David Revoy, he helped design this filter and uses it often.

You need to add gmic to PATH. See:

You need to run the filter at least once. Then GIMP gives you the option to repeat the filter. Select that menu item or shortcut in BIMP.

Thanks for all your help. I’m just a little confused on how to repeat the filter in the manipulation set.

I applied the filter to one image, copied the G’Mic command to clipboard, and pasted it into “G’Mic Command String, when non-interactive”. I didn’t see an option to repeat filter in the manipulation options, so I’m not sure how to add it.

I am talking about the builtin GIMP feature that allows you to repeat the previously applied filter. Can BIMP access it?

image

It probably can, I’m just not sure what to put in to have it perform that command. I got the command string to work though. It’s prompting me for every image, so I’ll need to keep playing with settings, but it is colorizing with the settings I put in, so that’s promising. Thanks for all your help!!!

Report back. I only used BIMP once and that was when it first came out; it, GIMP and G’MIC must be very different nowadays (hopefully, much improved).

1 Like

So it’s only the interactive color that seems to prompt me with every image, other filters batch process without the need for input. So the issue was with the filter I used needing input, not the batch processing

Some time ago I’ve been searching the solution myself.
So, it is in the attached .zip archive with user.gmic and .bat file included.
There are also 2 wiki-articles from sourceforge.net which are not available now.
Additional links and description on how to manage everything is in the ReadMe file.

If a long reply is welcome, here it is then…

Instructions

Use GIMP or Krita to preview and apply filter effects.
In G’MIC Settings → Other choose “Verbose (log file)” in Output messages.
Browse to G’MIC log file in %AppData%\Roaming\gmic folder.
Create a user.gmic file inside %AppData%\Roaming\ folder.
Write down commands to execute inside this file.
Make a batch file with input images, command name from user.gmic file and output images.

user.gmic file

test_com:
fx_lylejk_painting 10,2,4,10,0,50,50

.bat file

mkdir D:\135_frames\new
cd /d D:\Downloads\gmic-2.9.0-cli-win64
for %%a in (D:\135_frames\*.png) do gmic -i %%a -test_com -o {0,f}new\\{0,b}.png
pause

Some helpful articles

G’MIC CLI Batch Processing.zip (912.4 KB)

1 Like

If you want to enter the CLI world of G’MIC, then you don’t need a bat file. user.gmic or one-liners are all you need. E.g.,

gmic input_glob *.png fx_lylejk_painting 10,2,4,10,0,50,50 output paintings.jpg

There are other saving methods. Of course, if you want to save to another directory, then you would have to mkdir it in advance. The command above will output paintings_000000.jpg

If there are many files to process, it may be better to use command apply_files to avoid loading them all in memory, but process them in a “streamed” way.

Great!
One more solution.
I would probably use it myself now.

It’s really possible to paste a required path before “*.png” and “paintings.jpg”.
True is that the output directory should be created beforehand.

And the drawback is… Oh, David has just written about it… Yes, in case with “input_glob” all files are loaded into memory. So, it may seem that the program is hanging while processing them. And if you cancel the operation none of the files will be saved. Batch processing with .bat file solves this drawback. David’s recommendation, too, I suppose.

Both of you can let us know what you want to do in terms of batch processing and someone will give you example commands.

I’m sure that people here are very welcome to help. And at the same time, I think, it is also appreciated if someone will try to find an answer himself. At least, make some tries…

You know, I decided to register on this forum to suggest the solution I knew. And it turned out that I’ve got a good solution from others myself.

After following David’s advice I discovered “apply_files” command and learned G’MIC CLI’s syntax better (using \" for quotation marks and \\ in file path, for example).
So, let me share the final result here, too.

Batch processing command with “apply_files”

gmic apply_files \"D:\\frames\\*.png\",\"fx_lylejk_painting 10,2,4,10,0,50,50\",0,-1,1,\"D:\\frames\\new\\paintings.png\"

The instructions to “apply_files” command are here: G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing - Reference Documentation - apply_files

Everyone learns differently. Sometimes, on the record is good because readers can jump in anytime. I suggest you quote your code with back ticks. E.g.,

`code` for a single line that can wrap around, or

```
code
```

for multi-line.


G’MIC has substitution and naming rules of its own. Exploring that may reduce the need for quoting entire paths. I think relative paths would work too.

1 Like