It is currently Fri Apr 26, 2024 12:03 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 62 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 3:24 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
Gimp version 2.10.20
Running G'MIC from Gimp and processing hundreds or thousands of layers (frames) doesn't work. It will lock-up eventually.
A useful solution is to run G'MIC from a command line. Instructions are for Linux but the idea will work on Windows.

Open a terminal and type 'gmic'
If you don't see anything your will have to install it. For ubuntu 'sudo apt install gmic' (about 155Mbs)
Next open Gimp > G'MIC and then 'Settings' and change the G'MIC output to 'Very verbose'. This is saved.

Image


Then start Gimp from the command line. Often the command is 'gimp' but for me it is '/GimpAppimage/squashfs-root/./AppRun'
Then 'open as layers' in Gimp or open a Gimp xcf file with many layers.

Open G'MIC and choose the filter you want to use. Often it will be a smoothing or anti-aliasing filter but all filters (except custom code) work this way.
For repairs, select a frame with the most artifacts to use as the preview layer. If changing the frames copy one from the middle of the sequence. It's best practice to copy-out the test layer out of the sequence before you 'Apply' the G'MIC filter. Then it won't be modified twice.

When you apply the filter to just one layer go back to the command line (terminal) and look at the G'MIC output. There will be many blocks of text but we are looking for the 'apply' sequence. Here is an example:
[gmic_gimp_qt]./apply/ v 3 fx_smooth_anisotropic 60,0.562,0.64,3.1,1.1,0.8,30,2,0,1,4,0,0,24


Insert this command and its parameters into a batch script originally written by David Tschumperlé

#!/bin/bash
mkdir ./done
for i in *png
do
gmic $i -fx_gcd_cumul_math 0,2,1,0,0 -o ./done/$i
done


This is where it is inserted into the script:
Image


Save the script and call it something like gmic-filter.sh
Make the script executable the same way as installing Gimp plugins.

Copy the script into the folder with the frames you want to change.
Open a command prompt in the folder and run the script
./gmic-filter.sh
It will make a sub folder called 'done' and put the modified frames in that.

It will take some time but completes successfully. The scripts can be saved and re-used.

Why do this?
Video editors are getting better all the time but mostly they don't support hundreds of image filters like G'MIC. I think it's also better to do as much pre-processing as possible.

This 100 frame GIF was made from a rotating fractal render of 800 frames smoothed with G'MIC and then processed with G'MIC Continuous droste.

Image


Advanced.
Complex G'MIC equations such as 'Conformal Maps' have to be put into inverted commas and have all spaces removed before pasting into the batch script.
fx_conformal_maps "0,1,0,((1.1+i*z/6)/(1.04-i*z/6))^6.2,0,0,0,0,0,3,0,0,1024,1024"


The script can be changed to only modify odd numbered frames, or all even numbered frames
#!/bin/bash
mkdir ./done
for i in *[13579].png
do
gmic $i -fx_jr_deform 0,9.35,0,26.74,1,0,-42.4,1,0,50,50 -o ./done/$i
done

Any combination of frames down to 1 in every 10 can be used.
for i in *[5].png

These altered frames can be copied out of the 'done' folder and used to overwrite the unmodified frames which have the same file name.


Last edited by Tas_mania on Mon Apr 19, 2021 12:21 am, edited 6 times in total.

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: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 6:03 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Batch Processing an image sequence with G'mic. That's an excellent Idea Tas_mania, thanks for posting the process. I can see many uses for this, example cartoonize a video sequence.


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 6:27 am  (#3) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2424
I know Tas_mania has had problems with BIMP but I have used it with 1000+ files - The one here viewtopic.php?f=15&t=18979#p259085 1200 frames ( 1min 20 secs @ 15 fps - no need for more fps with an animation) BIMP will take a gmic command as "another Gimp procedure" A little easier for Windows users than a command line batch file.

_________________
Image


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 6:40 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
In my opinion, I proposed a simpler method long ago: Actions RPL :roll: (but few have tried to use it: viewtopic.php?f=9&t=17395&start=10#p245677).
You open the images to be processed as layers:
1. You are using the selected filter (for example: GMIC) on one layer in INTERACTIVE mode.
Image
2. For the remaining layers, use the RUN_WITH_LAST_VALS mode.
Image
Image
This way you no longer need additional combinations.


Attachments:
GimpChat.gif
GimpChat.gif [ 4.02 MiB | Viewed 11505 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 11:48 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
You can also do it within G'mic if you set input layers to "All" and you can set it to export new
image also if you want. This took less than a minute to make.

Image

Bimp works well here, just make sure you set "Input Layer Mode" to 1.

Attachment:
bimp.png
bimp.png [ 77.21 KiB | Viewed 11456 times ]


I used your idea to make a Batch Processing script for ffmpeg and it works well. Here it is if anyone is interested.

#!/bin/bash
for i in *avi
do
ffmpeg -i "$i" -c:v libx264 -preset slow -level 40 -pix_fmt yuv420p -crf 20 -threads 8 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "new_$i.mp4"
done


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 4:54 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Here's one of my old animations converted using G'mic's "Sketch" filter. It was all done within G'mic and took just a few seconds.

Attachment:
plane.gif
plane.gif [ 2.89 MiB | Viewed 11427 times ]


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Dec 26, 2020 7:29 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
Interesting comments thanks guys.

Hi racer the sketch fighter plane is very nice.
GIF-size graphics don't make G'MIC hit it's memory limit. This technique is for videos.

I made a jello flying saucer with G'MIC crease.

Image


I think it's possible to make a cubist sitcom from old TV clips :(

I found G'MIC filters with comma separated values work but ones with equations in brackets don't work from the command line.
Maybe they need an escape sequence or maybe they just don't work?


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sun Dec 27, 2020 7:31 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
I think it kinda adds a little extra life, maybe retro to my goofy animation.

Attachment:
goofy2.gif
goofy2.gif [ 3.64 MiB | Viewed 11371 times ]


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Mon Dec 28, 2020 8:07 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
I did an experiment using the cubist filter on about 500 frames of a TV sitcom.
It looks jerky becuase the filter is applied to every frame. Need to reduce and smooth the effect.


Last edited by Tas_mania on Mon Jan 11, 2021 2:36 pm, edited 1 time in total.

Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Tue Dec 29, 2020 5:46 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Nice experiment, though I think you would've had a more interesting outcome using other filters like "Sketch" or something. Your end result looks like a case of bad low compression artefacts commonly seen on poorly encoded videos of old.

The only problem with using these types of filters on video, is the the resulting flicker can sometimes be annoying. It's hard to get a smooth look.


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Tue Dec 29, 2020 6:56 am  (#11) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2424
This one from almost 3 years ago https://youtu.be/jz8MaOXgREQ

Using Flowblade editor, which does what you can do manually, unpacks into frames, applies gmic filters, reassembles.

What is really needed is a up-to-date frameserver. I occasionally use avisynth but it is old and the filters show their age.

_________________
Image


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Tue Dec 29, 2020 1:16 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Yeah I used to use Avisynth quite a bit back when I ran Windows. Now that I only run Linux, I just use ffmpeg for the bulk of my filtering/encoding. Occasionally I'll boot my Win10 VM and run Avisynth on a video clip to blend frames to get motion blur on running water and so forth for special effects.

Here are a couple of interesting variations on my old Mustang animation..

Attachment:
Mustang2b.gif
Mustang2b.gif [ 2.17 MiB | Viewed 3008 times ]


Attachments:
Mustang2c.gif
Mustang2c.gif [ 1.21 MiB | Viewed 3008 times ]
Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Tue Dec 29, 2020 4:04 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
I agree the cubist filter looks rough on video :) Mustangs always look good.
The next one I did worked - Rodilius. I turned it down so it was more contained in the object and it tracked the rotating object perfectly. It's 632 layers with a shot from the Gimp animation window.

Image


This 3d fractal already looked good because the software can do iridescent lighting.

Image


I bleached it first and then applied rodilius using G'MIC from a terminal.

Hi Rich, that video looks good and its funny but its an 'overall' effect. I mostly make video components and stack them. Having the 2 people in the room done in flowblade with the room as original or something different would look amazing.
BTW - which one are you? :lol


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Wed Dec 30, 2020 7:10 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Here's my Mustang using G'mic's "Blur [Dept-of-Field]" filter applied.

Attachment:
Mustang-blur.gif
Mustang-blur.gif [ 1.12 MiB | Viewed 2963 times ]


"Rain & Snow" filter applied.

Attachment:
Mustang-Rain&Snow.gif
Mustang-Rain&Snow.gif [ 1.61 MiB | Viewed 2962 times ]


"Old Photograph" filter applied.

Attachment:
Mustang-Old-Photo.gif
Mustang-Old-Photo.gif [ 837.79 KiB | Viewed 2959 times ]


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Wed Dec 30, 2020 6:24 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
Image


I got the old ratrod out of the garage.
This time with SamJ's 'Hallucinogen' paint work and the back ground done with LyleJK's 'Painting' filter.
I like Lyle's filter on panoramas but it's almost impossible to slow it down in a GIF.

I also used the Blur [Dept-of-Field] thanks for the tip :bigthup


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Wed Dec 30, 2020 10:35 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Dec 09, 2018
Posts: 644
Tas_mania, great idea, thank you for the explanation. I like your various results, the ratrod is looking good.

racer-x, Good to see the Mustang back with very cool gmic effects.

A first try with the old Beetle:


Attachments:
carp.gif
carp.gif [ 5.45 MiB | Viewed 2919 times ]
Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Thu Dec 31, 2020 5:54 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
The Rat Rod looks great Tas.

That Beetle looks awesome teapot, you even got the wheels turning.


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Fri Jan 01, 2021 4:54 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1333
Nice teapot. You've always got a trick up your sleeve. :bigthup
I like the semi-transparent windows and the wheels are an animation inside an animation.

Hope you have a good year in 2021.


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sat Jan 02, 2021 10:18 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Dec 09, 2018
Posts: 644
Thank you racer-x and Tas_mania. I hope you both have a good year in 2021 too.

With illustrationlook or psyglass filters:

Attachment:
carillustrationlook.gif
carillustrationlook.gif [ 2.24 MiB | Viewed 2824 times ]


Attachment:
carpsyglass.gif
carpsyglass.gif [ 4.38 MiB | Viewed 2824 times ]


Top
 Post subject: Re: How To Run A GMIC Filter On Hundreds Or Thousands Of Layers
PostPosted: Sun Jan 03, 2021 1:23 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
That's cool teapot. Here's a Vintage style filter.

Attachment:
Vintage-style.gif
Vintage-style.gif [ 1.05 MiB | Viewed 2794 times ]


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Apply filter to all layers

6

No new posts Attachment(s) Gmic:morphological filter

7

No new posts Attachment(s) Trying to open as layers 3 til files Red, Green, Blue, Filter images

2

No new posts Attachment(s) New filter using Gimp&Gmic: FAKE KNITTING

36

No new posts Attachment(s) New filter using Gimp&Gmic: GUIDED POLYGONIZE (upd)

58



* Login  



Powered by phpBB3 © phpBB Group