Jump to content

Reptorian's G'MIC Code Workshop


Reptillian

Recommended Posts

Hi,

 

I'm in the process of remaking existing PDN plugins/filters into G'MIC with credits applied and giving them more features, and I believe I have almost learned enough of G'MIC scripting to do what I want (I still need to know how to work with rotating using mathematics or something like that to learn enough though, so...). So I will be making G'MIC varients of certain filters here. And, I am posting here because I'd believe I'd have more testers of codes in here.

 

To download G'MIC filters that aren't found in the official updates, you have to type in %appdata%/gmic into explorer, and copy and paste code into somewhere you'd like. Kate text editor works, and I'm not too sure about Notepad++,bu that can work too. Sometimes, you may have to make the tabs and things like that before using that code or just test it within code[local] filter.

 

Report issues related to my G'MIC filter here - https://github.com/Reptorian1125/gmic-community

 

Reptorian's GMIC code - https://github.com/Reptorian1125/gmic-community/blob/master/include/reptorian.gmic

Edited by Reptillian
Update

G'MIC Filter Developer

Link to comment
Share on other sites

Is there an official G'MIC repository for "community" filters?

 

A tutorial of sorts for demonstrating the conversion of a PDN effect to a G'MIC filter would be helpful.  There's potentially a lot to cover (as you said, the manual is over 400 pages), but the basics should be enough for people to get started.

 

I'm moving this into Plugin Developer's Central.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

11 minutes ago, toe_head2001 said:

Is there an official G'MIC repository for "community" filters?

 

A tutorial of sorts for demonstrating the conversion of a PDN effect to a G'MIC filter would be helpful.  There's potentially a lot to cover (as you said, the manual is over 400 pages), but the basics should be enough for people to get started.

 

I'm moving this into Plugin Developer's Central.

 

No. They usually go under testing if you want to have these codes into the g'mic filter database. They only go in outside of the filter once they seem to be "finished". I would argue some of the testing filter are already finished though. If they don't seem to be great or eh, there's really no issue about them being in the testing. Some are buggy, and that's a reason for some of them under testing.

 

Well, I think I can demonstrate a example of converting PDN HSL Posterization to G'MIC filter with even more color space and control at some point as that is something I"ll be making soon.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Update:

 

Vibrato filters has been merged into one vibrato filter. You can manipulate multiple channels at once or edit them one-by-one. See note below the vibrato filter as there is a issue. However, a workaround exist though.

 

A sample of modifying saturation and value channels at once with vibrato

 

2093088097_FireandIceVibrato.png.0ca44b165edfb2dbdc5327596050446d.png

 

Next up - Replicating Alien Map from GIMP, but with support for multiple color space of course. After that, Channels OOBS (Overblur/Overline/Blur/Sharpen) with the same controls as Vibrato.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

  • 4 weeks later...

Just want to announce that the Vibrato filter has landed, and unlike the one in this forums, it works with multiple color spaces and it actually works with alpha channels, plus you can either edit all the channels at once or individually.

 

Also, there is a OOBS(Channels Overblur-Overline-Blur-Sharpen) filter which is basically 3-4 different PDN plugin into one, and I could extend it by adding blending mode which is something I'll have to do when I get the time and will to do that. OOBS in essence is like overblur, overline, and maybeone of the filter @BoltBait has made all into one. I'm not sure on the last part.

 

Made an advanced embossing/reliefing filter which again is inspired by the PDN filter. There is a new mods_ops commands (please don't make filters yet with it, I am going to add the option to use a secondary layer or a copied image for PDN users to be used as maximum value reference layer) which utilizes continuous and standard forms of modulo operations, as well as a inversion option. Refresh to see the filters. You can use the mods_ops via code [local]

 

mod_ops : 0>=ops<=5,chan_v>0, 0>value(%)<=1,alpha_preserve>=0

 

ops = (0=Modulo Standard ; 1=Modulo Continuous ; 2 = Modulo Division Standard ; 3 = Modulo Division Continuous ; 4 = Modulo Addition Standard ; Modulo Addition Continuous)

chan_v = Channel value - Use 255 for 8-bit operations, but set to 1 or 360 for other operations

value = Uses the chan_v as a reference for modulo operations

alpha_preserve = if yes, preserve alpha, else if no, the operation is performed on alpha channel

 

Is there an official G'MIC repository for "community" filters?

 

@toe_head2001 I found out that the repository for the community filter is here - https://github.com/dtschump/gmic-community

 

Basically, if you have any code you want to see in G'MIC. Add your_username.gmic and use the template, and then copy your g'mic code into there.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

Have just added blending modes options to the OOBS filter. Not doing any more work since it's not a really good filter, but it works. It's 5 existing PDN filters into 1. It will be here at some point before G'MIC v.2.5. By the the modo and modf has been done too. Those will replace mod_ops. The purpose are still the same, and they are to manipulate gradients or be used for glitch art.

 

Almost done with the Concrete Texture filter for G'MIC

 

image.png.4f5b7d8d99138bd09f685e981a98b5d1.png

 

Here's a sample. The relief filter section doesn't work on the concrete texture filter yet, so I had to manually apply relief filter. But, here is what it can look like.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

News! Construction Material Texture is going to come to G'MIC in less than a week. So you can use it on Paint.NET soon when it arrives.

 

Here's the work so far, all that's missing is the Butterworth Bandpass filtering code, and it'll be done. -

 

 

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

Hi, @Reptillian   First, thank you for all your work concerning the G'MIC plugin.

 

Second, a question.  Will the Construction Material Texture filter and all new filters made be automatically added to the G'MIC when we open it?

Because you uploaded it to the website that the G'MIC plugin gets the filters from?

 

Ha...that was poorly worded...but you get the gist!  :)

Link to comment
Share on other sites

7 hours ago, lynxster4 said:

Hi, @Reptillian   First, thank you for all your work concerning the G'MIC plugin.

 

Second, a question.  Will the Construction Material Texture filter and all new filters made be automatically added to the G'MIC when we open it?

Because you uploaded it to the website that the G'MIC plugin gets the filters from?

 

Ha...that was poorly worded...but you get the gist!  :)

 

The place where people provide their filter codes is in G'MIC Community at Github. Once their pull requests are accepted, it is available at G'MIC upon refresh. RIght now, they're not at the official G'MIC, but however, you can get them early by copying the filters to and paste it within %appdata%/gmic/updatexxxx.gmic where xxxx is your version of g'mic. @G'MIC is probably taking a break, so you might have to copy and paste them into that file.

 

Vibrato is already available upon G'MIC refresh, and so is advanced emboss/relief as well as OOBS. OOBS as of current G'MIC does not have blending modes yet, but this patch below has it. The Construction Material Texture is not available, so if you want that you'll have to copy and paste for now.

 

Patches for updatexxxx.gmic

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Well, it seem like I decided to continue making new G'MIC filter as my main computer is overheating and I stepped out of doing filters for a while. I'm using my secondary computer.

 

My options -

 

A ) Finish Transfer [Reduced Colors] filter, this filter basically transfer colors from reference image to a target image using a palette of colors from the reference image, and the target result contains only the palette colors. From 2 colors to 4096 colors. It works well with PDN limitations, but I also have to make it work as I want it to work with 3+ layers the way I want to on GIMP and Krita as well, so that is why it is not on G'MIC yet.  @nycos62 , does this benefit pixel artists? If it does, should I release this regardless of the bug? 

 

B ) Pixel-art scaling

 

C ) Wood texture

 

D) Improve my Construction filter, any suggestion welcome. I thought of laplacian normalization processing. And also I can add color processing using LAB channels and adding red,green,blue, yellow sliders. Are these the only thing that needs to be added? Is there a technique I can implement akin to Butterworth Bandpass processing? Should I add description?

 

E) Implement Modulo Blending Modes to self-cascading glitch filter. Regular modulo already exist, so this would be about continuous regular modulo, divisive modulo, continuous divisive modulo, modulo addition, continuous modulo addition.

 

F) Bubble filter

 

Besides those long filters, I might update my modulos operation using modf and modo while being able to perform them on separate channels using a number or image for calculation.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

8 hours ago, Reptillian said:

does this benefit pixel artists?

 

Hello Reptillian,

the purpose of reducing color palette could be applied like this :

you get a photo of an existing place or object, you scale carrefully image to your game scale, then you reduce colors to obtain a starting point to draw over a sprite, yes , why not !! :)

 

for your B ) point, if you can "magically" scale this into this, you are the man !!

Bitmap Brothers Tank in Z game (artwork from Dan Malone I guess)

original scale VS reworked X2 :

tank_Scale2.png.f804e15b1d3dccaf6f51ec84ab809290.png

 

If you really want to dig into the sprite scaling, here you will find a very efficient technique https://imgur.com/a/gRXPJ 

(for what I understood, it use spline and pixel neighbour's comparison + edge detection to correct splines trajectories to guess the hidden details, it's not a simple filter applied on a picture)

demo_scaling.png.2a8b3a3f924e74c8291dce360b2faa70.png

 

 

 

*I'm not a professional pixel artist, I'm making 2D games in my spare time, so take my opinions with moderation.. I work as developper for business applications, not always fun 😱🤯

 

Edited by nycos62
  • Like 1
Link to comment
Share on other sites

Since at the moment, I'm not really ready to update my gmic as I still want to do a few more filters before I upload to g'mic community, I decided to prematurely release the g'mic code for transfer color [reduced colors].  This code will be deleted once it gets to G'MIC of course like I did with the Vibrato code.

 

1. Type in %appdata%/gmic in Windows Explorer

2. Copy and paste this inside updatexxxx.gmic somewhere between the end of preview of a filter, and before #@gui, and then go to paint.net -> advanced -> g'mic QT, type in Reduced Colors and this should show up.

#@gui Transfer Colors [Reduced Colors] : tcrc, tcrc_preview(0)
#@gui : sep = separator(), note = note ("<b>Transfer Color Setting<b>")
#@gui : note = note ("<i>If using all layers as input layer, the layer is the reference layer. If using active and above/below, the layer is the target layer.</i>")
#@gui : Layer to Use as Reference/Target Image = choice(0,"Top Layer","Bottom Layer")
#@gui : 1. Is reference image smaller than target image? = bool(0)
#@gui : 2. Color Count = int(16,2,4096)
#@gui : 3. Color Dithering (%) = float(50,0,100)
#@gui : 4. Color Indexing Method = choice(1,"Median Cut","Median Cut and K-Means")
#@gui : 5. Alpha Value Count = int (2,2,255)
#@gui : 6. Alpha Dithering (%) = float(50,0,100)
#@gui : 7. Alpha Indexing Method = choice(1,"Median","K-Means")
#@gui : sep = separator(), note = note ("<b>Local Contrast<b>")
#@gui : 7. Spatial Radius = float(80,2.5,200)
#@gui : 8. Amount = float(0.5,0,5)
#@gui : 9. Darkness Level = float(1,0,4)
#@gui : 10. Lightness Level = float(1,0,4)
#@gui : sep = separator(), note = note ("<b>RGB Adjustments<b>")
#@gui : 11. Brightness (%) = float(0,-100,100)
#@gui : 12. Contrast (%) = float(0,-100,100)
#@gui : 13. Gamma (%) = float(0,-100,100)
#@gui : 14. Hue Shift (%) = float(0,-180,180)
#@gui : 15. Saturation (%) = float(0,-100,100)
#@gui : sep = separator(), note = note ("<b>LAB Adjustments<b>")
#@gui : 16. Lightness Brightness (%) = float(0,-100,100)
#@gui : 17. Lightness Contrast (%) = float(0,-100,100)
#@gui : 18. Red Chroma (%) = float(0,-100,100)
#@gui : 19. Green Chroma (%) = float(0,-100,100)
#@gui : 20. Blue Chroma (%) = float(0,-100,100)
#@gui : 21. Yellow Chroma (%) = float(0,-100,100)
#@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right","Duplicate horizontal","Duplicate vertical","Checkered","Checkered inverse")
#@gui : sep = separator(), note = note("<small>Author : <i>Reptorian</i>      Latest update: <i>2019/1/31</i>.</small>")
tcrc : if {$1==1} rv fi ac[^0] "tcrc_adjustment ${9-23}",rgb rv[0,{$!-1}] repeat {$!-1} l[{$!-1},$<] tcrc_colormapping[0,1] ${2-8} endl done rv[0,{$!-1}] if {$1==0} rv fi

tcrc_colormapping :
rv
split_opacity[1]
to_rgba[1]
+colormap[0] {$1?$2+1:$2},$4,1
index[1] [3],{$3/100},1
l[2] skip {ia==255} if {ia!=255}
autoindex  $5,{$6/100},{$7}
n 0,255
fi
endl
rm[3]
to_rgb[1] a[1,2] c
rv

tcrc_adjustment :
fx_LCE ${1-4},1 adjust_colors ${5-9},0,255
rgb2lab
s c
l[0] adjust_colors $10,$11 endl
l[1] +adjust_colors 0,$12 blend lighten +adjust_colors 0,$13 blend darken endl
l[2] +adjust_colors 0,$14 blend darken +adjust_colors 0,$15 blend lighten endl
a c lab2rgb

tcrc_preview :
tcrc $*


 

 

Reference Layer - http://amiga.lychesis.net/resolution/Lowres/Corruption_17_Casino.html

Target Layer - https://www.pexels.com/photo/eiffel-tower-paris-1267533/

 

Result of Reference Layer to Target Layer

image.png.a30272e6fdf83dcd26b6d0f1bcc4d047.png

Edited by Reptillian
Fixed tcrc_colormapping
  • Like 3

G'MIC Filter Developer

Link to comment
Share on other sites

In relations to my last few post, I have implemented triangle wave in cascading glitch filter which would be E option. However, I still want to wait on that as the original author isn't back on developing filter. I'll give it 2-3 months for E, and if she had not returned, I might have to put my own version on reptorian.gmic if i am not granted permission to edit joan_rake.gmic file. It turns out I still need to do work on reduced color filters, so I'll figure out something sooner or later, but it's not a filter I would prioritize on since pixel art isn't really my thing. I'm working on finally implementing modulo operations cli into a filter. The main thing I need to figure out is how to apply those operations per every two layers and by channels separately and then blend them.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Solved the LAB editing issue on transfer color[reduced colors] I found out that the contrast effect goes over the range of [0,255] so, I had to apply cut 0,255 command. Now, it's ready for use though there's still a issue with preview, but however, that wouldn't affect productivity so much.

 

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Joan Rake is back, so the changes that I applied to Cascading self glitch filter will be there. She has merged the changes. I also do collaborate with her from time to time. However, I will be taking a break, but as always, you are welcome to leave issues or feature requests in here or in here or by discuss.pixls via PM -https://github.com/Reptorian1125/gmic-community

 

How do I enable issues on github? P.S I consider changes to default parameters as well.

 

I have considered trying to add existing palette to transfer color reduced as well as chroma edit by ab channels into construction material, so doing those will be done after the break.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

2 hours ago, Reptillian said:

How do I enable issues on github?

 

Click the Settings tab in the GitHub Web UI and toggle the Issues checkbox that is located under Features.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...