Jump to content

Reptorian's G'MIC Code Workshop


Recommended Posts

I have just made the fragment blur. Here's the output example.




- Inputs -

Color Space - LCH

Superimpose w/ Original - Checkmark Yes

Duplicates Count = 6

Distance (%) = 73.5%

Angle = 151.2

Boundary Condition - Mirror

Interpolation - Checkmark Yes

G'MIC Filter Developer

Link to comment
Share on other sites

Now, my version of fragment blur is coming to G'MIC soon.


My next project is this -


rv to_rgb[^0] f[0] "i(i#2/255*w#1,i#1/255*h#1)"


This basically treats the bottom layer as a blending mode. The value gives the coordinate. You do need 3 images for this to work though a workaround is to import file(s).






The result of the code. The Left determines the Y, and the Middle determines the X, and the result treating image as a blending mode is on the right.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Another update - I may be able to complete the pdn glitch art serie transfer to G'MIC. The missing one is spiral transform. I discovered @G'MIC made spiralbw (I think he did).


to_a +spiralbw l. +to_rgb a c endl f[0] "i(i#1%w,floor(i#1/w))" k..


The above gives spiral transform,that means I am able to do what the original pdn glitch author wanted to do, but can't.


Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

New Filter is coming soon!

The new filter is named 'Spiral Matrix Transform'. Inspired by the pdn glitch plugin which utilize ulam spiral transform. It's not the same thing, but it's actually reversible. Also, you can destroy images in a glitch-art manner by applying a blur filter or smoothing filter after you applied spiral transform, and then reverse it.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Actually, I got bad news for the Spiral Matrix Transform filter. G'MIC dynamic array doesn't support anything bigger than 4096x4096.


G'MIC Community Issue #174 - Very strange bug when it comes to vector or spiralbw - Reptorian


So, that filter will have to wait for a while. I decided to put in a wait time list before coding in a filter restriction. I'll give it a month. Meanwhile, if you would like to use it, you'd have to copy and paste code into update.gmic if you would like to use it. It's useful for creating interesting looking borders or has application for glitch art.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Meanwhile the spiral matrix transformation is on hold because of the dynamic array limitation of G'MIC (limit is 4096*4096), and I don't know how to convert it into a 1D formula to avoid that issue, I decided to take my time to solve the PDN Nebulous plugin and convert it into G"MIC format. Now, it becomes easier to maintain, and I am able to expand it since it is easier to make more complicated version of PDN plugin in G"MIC. Here's the result of my work so far.




As you can see, this is a nebulous texture. Only 1 Channel, and this is the output. I could get the color by using nebulous effect on one g'mic layer, and then normalize it to 0-360 range and have 100 for second g'mic layer, and have 100 for third g'mic layer. Then append_channel, and then I type in hsv2rgb to get the rainbow version.

  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

Okay, I think I got it now. It behaves a little differently than its PDN equilavent, but that's ok. I added new features regardless. It's on testing phase as I haven't made the GUI yet, but can be tested via code[local] once it arrives. I may add angle for distortion as well though I believe that would be difficult.


Here's the options


#@cli rep_nebulous: _color={ 0=gray | 1=color },_rings>0,zoom_scale_x>0,zoom_scale_y>0,-100<=x_center[%]<=100,-100<=y_center[%]<=100,0<=_fxyangle<=360,_wave,0<=_lighting_angle<=360,_disturbance>=0,_distx,_disty,_subpixelevel,0<=_subpixelprocessingmethod<=4


The new feature as you can see are shifting, and angle. Also, wave has been adjusted to make it more intuitive. Like 0 wave makes rings instead of waves.


Nebulous may come soon to G'MIC though that depends on whether the CLI order is fine. If not, I'll have to change the order for G'MIC CLI users.




@MadJik : Thank you for making this possible!



EDIT: Figured out how to apply angle distortion. At this point, it's the best Nebulous filter could get. GUI version will have alpha option.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

Spiral Matrix Filter is here. By the way, if you are going to reverse the transformation, there's a limitation of 4096^2. Anything beyond that will have a error. That is IEEE Float restriction. I will someday get around that limitation, but for now, I have no interest into bothering to try. Reverse-Forward will work as well as Forward-Reverse.


EDIT - G'MIC Nebulous has been pushed, and it's here.


Look like I'll have to fix NCEE filter, well ok.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

I checked the update via pdn gmic, looks like y'all going to have to wait for new version to retrieve spiral matrix filter, and g'mic nebulous.


Another filter is coming again. I just replicated @MadJik Gravity filter for G'MIC.


For now, I have this.


#@cli rep_sptbwgp: (eq. to rep_shift_pixel_to_boundary_with_group_pixels)
rep_sptbwgp: rep_shift_pixel_to_boundary_with_group_pixels $*
#@cli rep_shift_pixel_to_boundary_with_group_pixels: _axis={ 0=Horizontal | 1=Vertical }, 0<=_position<=1, _threshold
#@cli : Shifts pixels to boundary by percentage using grouped pixels. position less than .5 means shift will be negative, and position greater than .5 means shift will be positive.
repeat $! l[$>]
skip ${3=0}

if s==1||s>5 v + error "Spectrum depth cannot be less than 2 or greater than 5!" fi
f "s==2?(i1<$3?0:i):(s==3?(i2<$3?0:i):s==4?(i3<$3?0:i):s==5?(i4<$3?0:i))"

if $dir<0||$dir>1 v + error "Exceed the boundaries!" fi

if $1
s x
repeat $! l[$>] r 1,{h+1},100%,100%,0,0,.5,1 autocrop_components ,,,, a y r 1,$ih,100%,100%,0,0,.5,$dir endl done
a x
s y
repeat $! l[$>] r {w+1},1,100%,100%,0,0,1,.5 autocrop_components ,,,, a x r $iw,1,100%,100%,0,0,$dir,.5 endl done
a y
endl done


A new feature is planned though. I will be adding influence factor. Also, unlike the pdn gravity, you can put it to the center than into the boundary by setting position to .5.




While making a command to make the map to be used as a base, I have to wonder, does this need to be it own filter?




Result of the command I made



Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Now, you can test my filters as G'MIC 2.6.2 has been released for Paint.NET.


Image #1




Shift Position = -1, Axis=Vertical, Influence Factor=.5





Shift Position = 0, Axis=Vertical, Influence Factor=1


Influence Effect isn't perfect though as in some cases there will be pixels that are detached. Don't know what to do about that, but this is my best attempt for the scope of this filter.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Initially I totally misread those images! I figured the rainbow was dropping onto the hillside & couldn't figure out why the profile of the skyline was being altered. Doh!

Link to comment
Share on other sites

Ok, just uploaded the change of one sided backdrop instead of two to reduce distortion when using influence factor. Not perfect, but it works better than two sided backdrop. Now to wait since I don't have access to merge request. It will be for G'MIC 2.6.2. Also, did fixed a nebulous bug.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Now, I have successfully fixed all issues with my Grouped Pixel Axis-Based Shift which is extended version of @MadJik Gravity filter. Should here shortly. By the time you read this post, it's probably here.


If it say  2019/5/14 , then it means it arrived.


For proof!





No change to above image.




Axis=Horizontal, Influence is between 0-1, position is between 0-1


With the new changes I commited to g'mic-community, lines don't break anymore.



Filter update has arrived.


Also, I made scintilate as well. This one works on YUV color space.



r. {$mini_square*100}%,{$mini_square*100}%,100%,100%,1
r. $large_square,$large_square,100%,100%,0,3
rotate. 62.5,1
r. $iw,$ih,100%,100%,0,0,.5,.5
r. 100%,100%,1,$is,0
*. 255
f... "abs(i#0-i#2)"
a[^-1] c k..

Paste that into code[global] or code[local] and see what you get.


You can also change color space, but use 8-bit color space. See G'MIC reference.


You can edit mini_square and numbers next to rotate. On second part of rotate, 0 = nearest, 1 = linear, 2 = bicubic

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

6 new palettes has been added. It was pushed by gmic maintainer 6 hrs ago


Name ; ID

- Amiga 7800 M.E.S.S palette ; amiga7800mess
- Amiga 7800 NTSC ; amiga7800ntsc

- Amiga 7800 PAL; amiga7800pal

- Sam Coupe ; samcoupe

- VGA; vga

- Deluxe Paint; deluxepaint


Their number id details here - https://github.com/dtschump/gmic-community/pull/182/files


Type in "pal {palette id} k." in code global/local to verify


There are now 143 palettes for G'MIC




I am near at a point where I’ll be rewriting the Concrete Material Texture for new features altogether, besides the seamless issue, I believe I could use several different ideas. As many as possible. But then again, I might work on true autochrome stimulation, though it’s one or the other at this point.

Here’s on my backnotes -

  • Color Blending Factor - Forces the result to stay within a certain colors
  • A-B Contrast - Lower Contrast means less blue and/or yellow and/or less red and/or green. And higher contrast means more saturation on blue, yellow, green, red.
  • Fix seamless-ness
  • Local Contrast

Some ideas I just thought off

  • Minibumps- This just add a mini bumps surface over the concrete material.
Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

18 new palettes and more Nebulous fixes have arrived. A double multipler for disturbance level is needed for precision purpose. Also, I created a option to link x and y factor with disth and disty for flexibility purpose.


- Palettes changes -

amiga7800 ntsc/pal series is now just amiga7800.


C64 palettes now has two interpretations - Colodore and Pepto.

So, their cli code is pal c64_colodore and pal c64_pepto


Fornax Void palettes, 2 autochrome palettes, and popular user palettes like nature embrace 55 been added.




What's coming? Rewrite of construction texture, asmageddon tools with 3 boundary condition and interpolation. I already recreated strange bulger a and b(Merged), and sinusoidal shaking.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

WOW! @Reptillian  you've been very, very busy indeed!  Very much appreciated!  👊  :)


  • Like 1
Link to comment
Share on other sites

I'm just gonna show off what I have here. I converted the quaddro bumperoo/inverto into g'mic code, and mixed them, and extended them with the option to use and,or operation instead of xor.


Sample Image




Generated from this code -

rep_binaltquadtex 10,6,99,2,0 % 361
{w},{h},1,1,1 {w},{h},1,1,1
a c

Note: rep_binaltquadtex is not available yet. rep_binaltquadtex is separated from the % 361 as I want the option to use it as a coordinate map like I did with spiral matrix. As you note, rep_binaltquadtex is one channel only.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

I have some bit of news. Right now, I'm back to revisiting my construction material texture. I'm going to attempt to try to get close to a real road texture as I'm adding secondary turbulence and noise filtering alongside with breaking them into shapes, and adding distance transform. (Distance transform already exists in g'mic. See Distance (+) in g'mic reference.) That way, users will have the option to stimulate road texture.


For further explanation, I'll be giving this picture -



This is G'MIC Crystal as it own layer, and Thin Edge into another layer, then the thin edge has the distance transform treatment and is set to hard light mode. The bottom layer has gradient map, and hue shift change. This is going to be added as another processing variable for construction material texture to have the option for a realistic road.


After that, I'll be releasing these new filters into g'mic:


  1. Binary Alternating Quaddro Texture [Basic] - Description : A filter based off integrating Asmageddon texture generators found in this thread source code - Asmageddon's Tool Pack V3 Thread

    The filters that have been combined into this one basic filter is Quadro Bumperoo,Quadro inverto,Quadro Sharper

  2. Binary Alternating Quaddro Texture [Multichannel] - The multichannel version of the basic code with multiple color space supports, and 8-bit processing as a option. RGB(A), CMYK(A),LCH(A)… are all supported. You can even swap channels in cases you switch into something like HSL, and LCH, but just want to reorder luminosity channel to fit the color space change.  One warning though, if you don't like 20+ parameters into a filter, you could skip this.

  3. Sinosoidal Water Distortion - A filter that can degrade image with sinusoidal image. This gives mostly glitch-like effect.  (The one and same as Asmageddon Prince's water, but this is more for other software users as I do believe in supporting more programs than one at once)

  4. Logarithmic Distortion - Just as title said. Though, it doesn’t yet offer pinching function, but it does support Kaleidoscope output. Heavily extended version of Asmageddon Prince distortion tool. Name been changed for a more appropriate name.

  5. Squareroot Logarithmic Distortion - Similar to above, but actually use squareroot function into it.

  6. Strange Bulger - Integrated Strange Bulger A, and Strange Bulger B with the option to treat boundary condition as mirror and bicubic interpolation support. You can also use nearest if you'd like.

  7. Strange Bulger Kaleidoscope - The Kaleidoscope version of above. Also heavily extended

What may be arriving if I feel like doing it

  1. Nebulous fix - I will actually have some channel swapped to make it more consistent with the grayscale mode, and I will also add a new option to generate luminosity from the color mode.


Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Update! The extended Asmageddon Prince PDN filter has arrived into G'MIC, press the update button to see them!


For programmers, I decided to restart my gmic-community fork, and start from scratch - https://github.com/Reptorian1125/gmic-community . I will continue updating my github branch. If you find a issue into my g'mic file, do not hesitate to report it. The fork isn't officially part of the official gmic community. It's just a separate place for people to report issue, and for those who are skilled to change code, they can do a pull request and I'll put it to the official gmic-community. You can also use the code to convert to PDN plugin if you wish, and I can assist you on that.


Code for my filters can be found here - https://github.com/Reptorian1125/gmic-community/blob/master/include/reptorian.gmic


Note: Nebulous fix is done, but is not on the update.



An issue - Logarithmic Distortion filter do crash. However, I'm not sure why it crash. Any one could shed some light here? A G'MIC programmer in another forum didn't find anything wrong. No div by 0 or inf.

Note: $1, $2, $3.... are all variables. Anything with $ next to it means it's a variable.


#@cli rep_logpindis: (eq. to rep_logarithmic_pinching_distortion)
rep_logpindis: rep_logarithmic_pinching_distortion $*
#@cli rep_logarithmic_pinching_distortion: _distortion_main>=0,-1<=_preshift_x<=1,-1<=_preshift_y<=1,-1<=_effposition_x<=1,-1<=_effposition_y<=1,_prescale_x,_prescale_y,_afterscale_x,_afterscale_y,0<=_angle<=360,_mirror_placement= { 0=outside-in | 1=inside-out },_lx_axis= { 0=different axis | 1=same axis},_ly_axis= { 0=different axis | 1=same axis},ix_dir={ 0=negative | 1=positive },iy_dir={ 0=negative | 1=positive },_boundary= { 0=Periodic | 1=Mirror },1<=_interpolation<=5,_dimension_ref>0
skip ${2=0},${3=0},${4=0},${5=0},${6=1},${7=1},${8=1},${9=1},${10=0},${11=0},${12=1},${13=0},${14=1},${15=0},${16=0},${17=5},${18=1024}
if $6==0||$7==0||$8==0||$9==0 v + error "Scale cannot be 0!" v - fi
if $17<1 v + error "interpolation cannot be less than 1" v - fi

shift {50*$2}%,{50*$3}%,0,0,3,1
f "
if $11 shift 50%,50%,0,0,3,1 fi


Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

I'm completely guessing - but where do you define $1?


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.

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...