Reptillian

Reptorian's G'MIC Code Workshop

Recommended Posts

Since new changes are not coming till 2.8, here's what will be available -

 

- Faster distortion filters with the usage of begin. Nebulous and Modulo Texture filter also have begin statements.

- Implemented Chaos from PDN Fractal Attractor to G'MIC Thorn Fractal

- Fixed Form Pixels

 

Honourable mention - Converted TR's Intense Filtration and placed it in G'MIC. It's more precise, but that's about it. Hue are in 0-360 range instead of 0-5999, this is more logical as well.

 

Upcoming - Upgraded TR's Glass Vignette with more than 10 options.

Edited by Reptillian
  • Like 2

Share this post


Link to post
Share on other sites

Extended version of Fibonacci Fill made by @Ego Eram Reputo , and @Red ochre will be coming to G'MIC 2.8. I did fixed Object Size filter, now dynamic gui is enabled there.

 

For more information: See this pull request - Fix to Object Size filter ; pal cli fixes, and new Fibonacci gui filter and cli filters #230

 

93cadadaa3fe6cf8a3ad2a3b0752e5d2c0313153

 

Minor note for CLI users - I added info to pal cli command.

Edited by Reptillian
Added animated png
  • Upvote 1

Share this post


Link to post
Share on other sites

Another new update, I figured out how to make graduated filter thanks to @TechnoRobbo. I am using YUV color space model than RGB for it. This allows for more options. I haven't pushed that yet or even done the filter, but it'll come by 2.8 or after.

Edited by Reptillian

Share this post


Link to post
Share on other sites

I liked the Self Spiral plugin made by @Xhin. So, I attempted to make my own with no success on adding skewing though. If you're reading this @Xhin, how did you add skewing? I'm looking for a way to add skewing based on -1,1 coordinate range.

 

x and y are basically coordinate of pixels while w and h are based on dimension of image.

r2dx 200%,3 #Resize Image using linear interpolation. Used for subpixel processing#
f "begin(
    sd=max(w,h)/min(w,h); #Find whether width or height is the great dimension size#
    sx=w>h?sd:1; #Variable to rescale coordinate#
    sy=w>h?1:sd; #Variable to rescale coordinate#
    ang=pi*(0/180); #Define Function Angle#
    slx=5; #Scale x-coordinate#
    sly=5; #Scale y-coordinate#
    skew_x=5; #Attempting to add skewing#
    skew_y=1; #Attempting to add skewing#
    rot_x(a,b)=a*cos(ang)-b*sin(ang); #Rotate Function#
    rot_y(a,b)=a*sin(ang)+b*cos(ang); #Rotate Function#
);
XX=(x/w-.5)*2*sx*slx; #Define x coordinate#
YY=(y/h-.5)*2*sy*sly; #Define y coordinate#
xx=rot_x(XX,YY); #Rotate coordinate#
yy=rot_y(XX,YY); #Rotate coordinate #
radial=sqrt(xx^2+yy^2)*1; #Create Radial Gradient#
if(1,
    sur_atan=(atan2(xx,yy)+pi)/(2*pi);, #If true, then spiral is in counter-clockwise#
    sur_atan=1-(atan2(xx,yy)+pi)/(2*pi); #Else, then spiral is in clockwise#
);
es=(sur_atan+radial*1)*1; #Get the base values for spiral#
es=es-floor(es); #Finally obtain the spiral gradient from the above equation#
if(0,es=(es>.5?1-es:es)*2;); #If true, then spiral in seesaw function or continuous#
i((es^1)*w,radial*h,z,c,2,3); #coordinate are obtained from this. i(x,y,z,c,interpolation,boundary)#
"
r2dx 50%,3 #Resize Image using linear interpolation. Used for subpixel processing#

Result -

 

Untitled.jpg.53becc0658cc343af11503a0cb90c8ed.jpg

Edited by Reptillian

Share this post


Link to post
Share on other sites

We're evidently doing things very differently so I don't know how well this will translate.

 

All of my distortion plugins work like this:

 

  1. Each pixel is converted into polar coordinates (Angle and Distance from the centerpoint)
  2. Some set of modifications happens to the Angle and Distance variables.
  3. The Angle and Distance are converted back into "source" cartesian coordinates.
  4. If the source coordinates aren't in the image, the image gets seamlessly mirrored in every direction infinitely to compensate.
  5. The current pixel turns into the source pixel, or gets averaged from whatever subpixel stuff is happening in the quality slider.

All of my distortion plugins are almost exactly the same except for step #2. If you mirror the distance, you get a Polar Reflection, if you reflect the angle you get a kaleidoscope, if you add the angle to the distance you get a spiral, etc. There's some more complicated trigonometry stuff that happens with "rectangular intensity" effects, but in the end you're still modifying the distance and angle.

 

So for the skew settings in my Self-spiral plugin, what's happening is you're adding the current X or Y coordinate to the distance. The code looks something like this:

 

D += __x_skew*x;
            
D += __y_skew*y;

So the float in your X Skew and Y Skew settings is determining what percentage of the X or Y coordinate get added to the distance. If you skew both the same amount, the effect skews diagonally.

 

If you did another polar-to-cartesian conversion, then instead of having only X and Y skew (or both) you could skew in any direction whatsoever. This will happen in an upcoming version of the plugin.

Share this post


Link to post
Share on other sites

@Xhin I actually found a solution after thinking on how to do what you did. It's quite a tricky solution seeing as I don't use polar coordinates. The 4 and 5 are done by i(#image_number,x,y,z,c,interpolation,boundary) and 5 can be done via the i command and/or gmic resize command. It is 2 that's different.

f "
xx=(x/w-.5);
yy=(y/h-.5);
new_x=x-.125*xx*x;
new_y=y-.25*yy*(h-y);
i(new_x,new_y);
"

If skew_y is negative, then I just insert (h-y), otherwise. It's just y.

Thank you.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Deleted earlier post.

 

I have made a pull request. Also, for the skewing, I thought off a better idea than adding into coordinate. - Formatting fixes, new filter 'Spiral Distort' #233

 

As you can see from the pull request, my idea was to use multiply and exponential to stimulate @Xhin Skew features.

{
    rot_x(a,b)=a*cos(ang)-b*sin(ang);
    rot_y(a,b)=a*sin(ang)+b*cos(ang);
}

XX=(x/w+offx)*sx*$13;
YY=(y/h+offy)*sy*$14;
xx=(rot_x(XX,YY)*(skew_m^(rot_x(XX,YY)*skew_x)))*2;
yy=(rot_y(XX,YY)*(skew_m^(rot_y(XX,YY)*skew_y)))*2;

XX defines the range of coordinate. sx and sy are scaling to the left side base on image ratio. $13 and $14 are basically multiplier for x-axis and y-axis. rot_x and rot_y function are used to rotate the result. Assuming a square image and scale of axis are 1, XX and YY would be [-.5,.5] range. xx and yy converts them into -1,1, but however the right side before the *2 is used to skew the axis. In G'MIC any number including itself is 1 when skew_ is 0. Otherwise, depending on the number, the ranges can shrink from one side, and the ranges are expanded on the other side. skew_m is multiplier. The default would be 2, but you can skew using 4 or 8 instead or any number greater than 0.

Edited by Reptillian

Share this post


Link to post
Share on other sites

More changes coming to 2.8

 

- TR's Intense Filtration gets better starting point parameter

- 100% bugfree Premade Palette GUI filter

Edited by Reptillian

Share this post


Link to post
Share on other sites

This goes to @HyReZ who wanted a faster version of shaped gradient filter

 

Decided to try to attempt extending @n d shaped filter. I gotta say that I'm not quite happy with it. I'll find some other methods, but I could release under request.

 

I had rapidly cropped from PDN screenshot, so please ignore the border.

 

monalisa.jpg.dd819e71a36e0221d398b75bcdd2643f.jpg

Edited by Reptillian

Share this post


Link to post
Share on other sites

I created a vector image in Inkscape, scaled it up (5K x 5K pixels), and copied and pasted it into Paint.NET (image A)

I applied the Shaped_Gradient plugin to both positive and negative spaces of Image A that I had on different layers to make Image B.


I next made each layer into an alpha mask that I applied a rainbow color wheel effect to make image C.

I needed a faster/better Shaped_Gradient effect to make more of this type of work.
Figure_112.jpg

 

Edited by HyReZ
inserting additional information

Share this post


Link to post
Share on other sites

I have been able to recreate the 3D gradient effect though the point displacement is missing. This one is now better than my previous attempt. Gradient color option can be added though. With my version, you'd be able to use original image colors or custom colors or blend both.

 

I do wish I can work with 3D in G'MIC, so I might be able to figure out how to create point_displacement as well as better anti-aliasing and more speed, but oh well.-

 

0d4854d93fdcb3731bf3a66a67f8a0c3d6fa0419

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

@HyReZ

I am about to finish the new Shaped_Gradient filter. I tested some other filters that is going to be incorporated into this one like streak and transformations and while I can't guarantee it'll be fast as that filter, it will have more features than that. And speaking of which, during developing a streak technique taking into account of opacity. I wonder if I should make a new filter using this.

 

zgQbZ2c.png

 

First, the left picture has G'MIC-QT filter 'Random Shade Stripe applied'. All the channels are affected. Next, I have applied my streak filter.If you look closely, the darker areas has more streaks than the lighter area. Areas with more alpha will be less affected than areas with less alpha.

 

Edited by Reptillian

Share this post


Link to post
Share on other sites
21 hours ago, Reptillian said:

I wasn't able to reproduce it.

 

The error went away when I changed the Line mode from SOFT to HARD. I have tried to make it crash again but I can not reproduce the error. Perhaps it was just my PC.

Share this post


Link to post
Share on other sites

Okay, it's coming though I have to work some quirks!

 

A preview of the g'mic version shaped gradient filter.

 

eWmDdNU.png

 

@HyReZ My test on 5k image with 64 GB RAM  - 1 minute. Though the flexibility is probably worth it.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Thanks for keeping us informed and for your interest and work on this plugin project!

Share this post


Link to post
Share on other sites
9 hours ago, Reptillian said:

 

@HyReZ My test on 5k image with 64 GB RAM  - 1 minute. Though the flexibility is probably worth it.

Thanks for keeping us informed and for your interest and work on this plugin project!
 

Currently I only have 16GB of RAM, but whatever improvement on render times will be appreciated.

Share this post


Link to post
Share on other sites

G'MIC 2.8 has arrived, note the latest filter I am working on (new updated shape gradient) haven't been finished, I am still having a lot of issues there and there. That being said, you do have these changes to keep in mind:

 

1) New Spiral Distort

2) Enhancement for Form Pixels for Paint.NET users. It was designed for GIMP or Krita in mind because G'MIC QT can make them resize layer to area that filters resizes images.

3) Chaos is now in Thorn Fractal

4) Extended TR's Pixel Sharpener

5) Fibonacci Fill Filter

6) Faster Nebulous and Distortion Filters

Edited by Reptillian

Share this post


Link to post
Share on other sites

Two new filters are coming to G'MIC-QT 2.8 GUI - Perspective Streak ; Axis Streak

 

@HyReZ I am finally done with the Perspective Streak filter. Just letting you know that the filter does anti-aliasing by itself, so a big image isn't going to be needed.

 

Perspective Streak

 

fad2b8b90b12e5646c979ba60a378b95ef48c351

 

Axis Streak

 

7d34bb28d362da74344cc1141ab2703cf063e3af

 

Pull Request - New CLIs ; 2 New GUIs

 

Edited by Reptillian
  • Like 2

Share this post


Link to post
Share on other sites

Nice work!

I work with large canvases because I have large prints of my works produced.

Edited by HyReZ

Share this post


Link to post
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.