It is currently Thu Apr 25, 2024 8:37 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Gmic tricks- How resurrect old version of filter
PostPosted: Fri Oct 14, 2011 6:40 pm  (#1) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
NO CODING KNOWLEDGE REQUIRED ! :mrgreen:

Gmic is constantly updated but sometimes the update may have unpleasant side effect:
as example user's presets broken by changes in some filter, or just was preferred the old version of some filter

It may even happen that an old filter had a bug but somebody find an artistic use of the bug's consequences and now he miss the bug

Doesn't matter why you miss the older version of some filter
Whatever is the reason you may resurrect the old filter, i will show you how


NOTE FOR LINUX USERS

This how to is tailored for Win users but the differences are minimal
For linux the most relevant difference is that the .gimp_def.xxxx file is a hidden file in your home directory, and you should just enter in the "view" menu of Nautilus or whatever is your file viewer and chose "Show hidden files"
And you will have a different text editor but it could be used exactly in the same way


Material

Windows users need a decent test editor because the windows notepad sucks so just grab and install this
http://download.tuxfamily.org/notepadpl ... taller.exe
(if you want to know more about see http://notepad-plus-plus.org/ )


WHAT YOU NEED TO KNOW

The code of all the Filters included in gmic is in a file called .gimp_def.xxxx were xxxx correspond to the gmic version number so as now would be .gimp_def.1504
And old files are (usually) not overwritten by gmic update
In windows 7 the .gimp_def.xxxx file is in C:/Users/Your_Name/AppData/Roaming, in Win XP in C:/Document and Setting/Your_Name/AppData

Now you want to resurrect the earlier version of a filter modified by an update, suppose just to make an example that is Unsharp Mask modified by an update to gmic 1.0.5.4 to 1.0.5.5

Start Notepad++ click File /open and open the .gimp_def.1.0.5.4 file...


Now find something there may seems hopeless but look the Notepad+ menu and click Search/Find

Attachment:
find.jpg
find.jpg [ 175.06 KiB | Viewed 5826 times ]


The name of all the filters of the gmic plugin start with "#@gimp" ...so if you want to resurrect "Unsharp mask" you should search for "#@gimp Unsharp mask" ...click Find and

Attachment:
search.jpg
search.jpg [ 229.11 KiB | Viewed 5826 times ]


done...now the never-ending file was automatically scrolled to show you the right code :jumpclap

select and copy the filter code, create a new file ( File/New ) and paste there the code that will look as

Quote:
#@gimp Unsharp mask : gimp_unsharp, gimp_unsharp_preview(0)
#@gimp : Sharpening type = choice(0,"Gaussian","Bilateral")
#@gimp : Spatial radius = float(1.25,0,20)
#@gimp : Bilateral radius = float(30,0,60)
#@gimp : Amount = float(3,0,10)
#@gimp : Threshold = float(0,0,20)
#@gimp : Darkness level = float(1,0,4)
#@gimp : Lightness level = float(1,0,4)
#@gimp : Iterations = int(1,1,10)
#@gimp : Negative effect = bool(0)
#@gimp : Channel(s) = choice("All","RGBA","RGB","Luminance","Blue/red chrominances","Blue chrominance","Red chrominance","Lightness","ab-components","a-component","b-component","Hue","Saturation","Value","Key","Alpha","ch-components","c-component","h-component","Red","Green","Blue","Alpha")
#@gimp : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical")
#@gimp : note = note{"\n\n<small><b>Note : </b>
#@gimp : This filter is inspired by the original <i>Unsharp Mask</i> filter in GIMP, with additional parameters.
#@gimp : </small>"}
#@gimp : sep = separator(), note = note("<small>Author : <i>David Tschumperl&#233;</i>. Latest update : <i>2010/12/29</i>.</small>")
_gimp_unsharp :
-repeat @# -repeat $8
-if {$1==0} --blur[-1] $2 -else --bilateral[-1] $2,$3 -endif
--[-1] [-2] -*[-1] -$4
--norm[-1] -t[-1] $5% -r[-1] [-2] -*[-2,-1]
-if $9 -*[-1] -1 -endif
--c[-1] 0,100% -c[-2] -100%,0 -*[-2] $6 -*[-1] $7 -+[-2,-1]
-+[-2,-1] -c[-1] 0,255
-done -mv[-1] 0 -done

gimp_unsharp :
-apply_channels "-_gimp_unsharp $1,$2,$3,$4,$5,$6,$7,$8,$9",$10,0

gimp_unsharp_preview :
-gimp_split_preview "-gimp_unsharp ${1--2}",$-1


Now don't get scared by the code...JUST LOOK TO THE VERY FIRST LINE

Quote:
#@gimp Unsharp mask : gimp_unsharp, gimp_unsharp_preview(0)



the first word "#@gimp" just means that is a filter for the Gmic plugin,
after there is "Unsharp mask" that is the name of the filter as will be displayed in the Gmic filter list,
you may wish to change that to avoid confusion so ,as example, you may edit in "Unsharp Mask 2"

NOW THE MOST IMPORTANT after the ":" the REAL filter name, the function name
a name that YOU MUST change to avoid conflict ...and you must change not only in the first line but in all its occurrences

Luckily we may use again the magic of Search/Find this time we use the "replace" tab, write "gimp_unsharp" and as replacement "gimp_unsharp2" then click "Replace all"

Attachment:
replace.jpg
replace.jpg [ 168.95 KiB | Viewed 5826 times ]


Now we must save the file in the same directory where is our gmic_def.xxxx file
and we MUST save the file with the name ".gmic" ( note the dot before the name ...here use Notepad+ instead then the Windows notepad is essential because the standard notepad will never allow you to save a file with a name starting with a dot, neither Win will allow you to rename a file by adding a dot before the name)

DONE !! :hi5

after all this fiddling here a little extra bonus

EXTRA BONUS

The first part of the code of a gmic filter is to create the graphic interface and set the Default,Min and Max value for each variable

In the case of our Unsharp mask the max value for Radios is limited to 40
But often, as in this case there is a upper limit only because required by the plugin architecture ,here limit was set to 40 because that seems a reasonable value (and it is in most cases a reasonable value)

BUt...Alas that limit make impossible use our Unsharp Mask for Local Contrast Enhancement that will require a radious of 100

...no problem we may change that raising the Max value to 100 as required for LCE so now the code will look as
Quote:
#@gimp Unsharp Mask 2 : gimp_unsharp2, gimp_unsharp2_preview(0)
#@gimp : Sharpening type = choice(0,"Gaussian","Bilateral")
#@gimp : Spatial radius = float(1.25,0,100)
#@gimp : Bilateral radius = float(30,0,100)
#@gimp : Amount = float(3,0,10)
#@gimp : Threshold = float(0,0,20)
#@gimp : Darkness level = float(1,0,4)
#@gimp : Lightness level = float(1,0,4)
#@gimp : Iterations = int(1,1,10)
#@gimp : Negative effect = bool(0)
#@gimp : Channel(s) = choice("All","RGBA","RGB","Luminance","Blue/red chrominances","Blue chrominance","Red chrominance","Lightness","ab-components","a-component","b-component","Hue","Saturation","Value","Key","Alpha","ch-components","c-component","h-component","Red","Green","Blue","Alpha")
#@gimp : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical")
#@gimp : note = note{"\n\n<small><b>Note : </b>
#@gimp : This filter is inspired by the original <i>Unsharp Mask</i> filter in GIMP, with additional parameters.
#@gimp : </small>"}
#@gimp : sep = separator(), note = note("<small>Author : <i>David Tschumperlé</i>. Latest update : <i>2010/12/29</i>.</small>")
gimp_unsharp2 :
-repeat @# -repeat $8
-if {$1==0} --blur[-1] $2 -else --bilateral[-1] $2,$3 -endif
--[-1] [-2] -*[-1] -$4
--norm[-1] -t[-1] $5% -r[-1] [-2] -*[-2,-1]
-if $9 -*[-1] -1 -endif
--c[-1] 0,100% -c[-2] -100%,0 -*[-2] $6 -*[-1] $7 -+[-2,-1]
-+[-2,-1] -c[-1] 0,255
-done -mv[-1] 0 -done

gimp_unsharp2 :
-apply_channels "-_gimp_unsharp2 $1,$2,$3,$4,$5,$6,$7,$8,$9",$10,0

gimp_unsharp2_preview :
-gimp_split_preview "-gimp_unsharp2 ${1--2}",$-1


that will not conflict with the older.

Note that is not always possible change the max value:
anyway most of the filter of the gmic plugin are based on corresponding command (same name except will start with #@gmic instead than #@gimp ) for the command line that are included in the same gmic_def.xxxx file,
if the corresponding native command has as limit ">0" ( more than 0 ) then the Max value may be raised if needed

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


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: Gmic tricks- How resurrect old version of filter
PostPosted: Sat Oct 15, 2011 9:08 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
Thank you very much for the tutorial.

And by the way - whether we will see gathering knowledge about the GMIC in one department ?

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Gmic tricks- How resurrect old version of filter
PostPosted: Sun Oct 16, 2011 5:04 am  (#3) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
i don't understand your question

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Gmic tricks- How resurrect old version of filter
PostPosted: Sun Oct 16, 2011 7:56 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
I had in mind - separate G'MIC forum:
http://www.gimpchat.com/viewtopic.php?f=9&t=2757&start=10#p35645

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Gmic tricks- How resurrect old version of filter
PostPosted: Sun Oct 16, 2011 10:00 am  (#5) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Not sure if will help much ...
a lot of question are already answered here http://www.flickr.com/groups/gmic/discuss/ and that anyway will remain the first place to search because would be impossible move old discussion from flickr to a new GC board

And even if a new board will be open most of flickr users will continue to post their question or on the gmic group or, if that would be closed, on the gimp users flickr group...i fear result would be delusive

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts [solved] For the new version of GMIC

2

No new posts Attachment(s) transfer filter settings to new version

7

No new posts Attachment(s) Gmic:morphological filter

7

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

58

No new posts Attachment(s) How To Run A GMIC Filter On Hundreds Or Thousands Of Layers

61



* Login  



Powered by phpBB3 © phpBB Group