It is currently Mon Apr 29, 2024 12:04 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Wed Sep 21, 2022 1:08 am  (#21) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 775
Location: SEA - South East Asia
Wow, exactly what I was searching for, thank you so much cli345 :tyspin

I just did increase the number of small circle to match the symmetry painting of GIMP.
Image

Is it possible to give an option to not show the external big circle?
Why?
To be able to do things like this > https://www.gimp-forum.net/Thread-Circu ... 3#pid30923 (after applying your filter > Recursive transform tool will do)
Also it would be easier also for a "pearls' neckless" without trying to remove the external big circle or being obliged to use the result of your filter and use it as template for the symmetry painting and re-do the circles with symmetry painting ;)
Image

Roughly to be able to do that after using your filter (no external circle/line parasitizing for further effect)
Image


Is it possible to have an alpha channel on the colors?
Image

The code I use with modif for 100 circles and bigger size
cl_circ_prerelease :
   # $1 : center x-coordinate
   # $2 : center y-coordinate
   # $3 : radius
   # $4 : stroke width

   fill. stroke(d)=cut($4-abs(d/2),0,1);stroke(sqrt((x-$1)^2+(y-$2)^2)-$3)
   n. 0,255

cl_innerCirc_prerelease :

   xC=$1 # center x-coordinate
   yC=$2 # center y-coordinate
   radi=$3 # big circle radius
   wid=$4 # stroke width
   nb=$5 # number of small circles
   lvl=$6 # number of levels

   if $lvl>0
      angl={pi/$nb}
      sinu={sin($angl)}
      ra={$radi/(1+1/$sinu)}
      ray={$radi/(1+$sinu)}
     
      +fill. 0
      [-1]x{$nb-1}
      foreach[1--1] {
         num=$>
         xA={$ray*cos(2*$num*$angl)}
         yA={$ray*sin(2*$num*$angl)}
         cl_circ_prerelease {$xC+$xA},{$yC+$yA},$ra,$wid
         cl_innerCirc_prerelease {$xC+$xA},{$yC+$yA},$ra,$wid,$nb,{$lvl-1}
      }
   fi

#@gui ____<b>Rendering</b>
#------------------
#@gui Tangential Circles (prerelease): cl_tangentialCircle_prerelease, cl_tangentialCircle_prerelease(1)
#@gui : note = note("<small>Warning: This is a slow filter.</small>")
#@gui : sep = separator()
#@gui : note = note("<b>Drawing:</b>")
#@gui : Big Circle Radius = float(100, 10, 1000)
#@gui : Dimensions = choice(0, "According to Radius", "According to Layer")
#@gui : Stroke Width = float(1,0.5,10)
#@gui : Number of Small Circles = int(5, 2, 100)
#@gui : Number of Levels = int(1, 1, 4)
#@gui : sep = separator()
#@gui : note = note("<b>Colors:</b>")
#@gui : Background Color = color(255,255,255)
#@gui : Foreground Color = color(0,0,0)
#@gui : sep = separator()
#@gui : note = note("<b>Effects:</b>")
#@gui : Effect = choice(0, "None", "Transparent Background", "Strange Polygon", "Multicolored", "Rainbow", "Double", "Colored Tube", "Red-Yellow Halo", "Blue-Cyan Halo")
#@gui : sep = separator()
#@gui : note = note("<small>Note: The preview might be much more aliased than the final result and some effects ignore colors.</small>")
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>. Latest Update: <i>2022/09/11</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé and Rod/GimpChat and an algorithm of Reptorian.</small>")

cl_tangentialCircle_prerelease:

   radi,dime,wid,nb,lvl,backR,backG,backB,foreR,foreG,foreB,effect=$*

   grow=3
   biggerRadi={$radi*$grow}

   rectWid={if($dime,w,$biggerRadi)}
   rectHei={if($dime,h,$biggerRadi)}
   chanNumb={if($effect,4,3)}
   $rectWid,$rectHei,1,$chanNumb,255

   local.

      xC={w/2} # center x-coordinate
      yC={h/2} # center y-coordinate

      if $effect==1
         backR,backG,backB=$foreR,$foreG,$foreB
      elif $effect>=7
         backR,backG,backB=255,255,255
         foreR,foreG,foreB=0,0,0
      fi

      foreA=255
      backA={if($effect==1,0,255)}

      cl_circ_prerelease. $xC,$yC,$radi,$wid
     
      cl_innerCirc_prerelease. $xC,$yC,$radi,$wid,$nb,$lvl

      blend screen,1

      n. 0,1
     
      if $effect<=1
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
      elif $effect==2
         fx_rodilius. 15,1,0,$nb,90,0,1,0,0
         n. 0,1
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
         n. 0,255
      elif $effect==3
         fx_curvature 10,0,100,0,0
         fx_gradient2rgb 0,0,100,0,0
         apply_curve 1,0,0,16,240,255,255
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
      elif $effect==4
         fx_dog 1.4,1.5,0,0,0
         fx_gradient2rgb 0,0,100,0,0
         apply_curve 1,0,0,64,192,255,255
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
      elif $effect==5
         dog. 1.4,1.5
         n. 0,255
      elif $effect==6
         fx_dog. 1.4,1.5,0,0,0
         apply_curve. 1,0,0,16,0,255,255
         cut. 0,255
         
         fx_distance. 0,2,1,0
         negate. [-1] [-1]
         fx_decompose_channels 8,1,1,0
         l.
            # inspired by emboss_image of Reptorian
            +apply_curve. 1,0,0,240,16,255,255
            l.
               b. 2.5
               gradient2rgb. 0 n. 0,255
               [-1]
               rgb2hsv[-2,-1] split[-2,-1] c
         
               l[-3--1] +[-3] {315} %[-3] 360 done
               l[-6--4] +[-3] {135} %[-3] 360 done
               l[-3--1] a c hsv2rgb s c done
               l[-6--4] a c hsv2rgb s c done
               rm[^-6,-3]
               negate..
               / 2
               +. 128
               blend grainmerge,1
            done
            to_rgb
            blend grainmerge,1
         done
         
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
         sharpen 300
      elif $effect>=7
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
         remove_opacity.
         split. c rm. rm..
         +fx_morphological. 0,2,10,"1,0,1; 0,1,0; 1,0,1",0,0,0,0
         +fx_morphological. 0,2,20,"1,0,1; 0,1,0; 1,0,1",0,0,0,0
         if $effect==8 reverse[-3,-1] fi
         a c
      fi
   
   done
   
   mv[-1] 0




In all cases, again thank you so much, it's already an awesome filter :tyspin yes > super :coolthup

_________________
Patrice


Last edited by PixLab on Wed Sep 21, 2022 4:46 am, edited 1 time in total.

Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Wed Sep 21, 2022 4:29 am  (#22) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 775
Location: SEA - South East Asia
Rod wrote:
I wonder if it's because i only have 500 MB of RAM on this Dell laptop. Can't be because of hard drive space as i have 42 GB of that.

:hoh :gaah


Image (thanks @Krikor for this emoji, I love it)

Yeah... 500MB that's not enough IMVHO, my pentium 4 had 512MB of RAM... it was something like 18-20 years ago.
When I run the filters from Claude (cli345) I can see in G'MIC (at the bottom) it reaches quickly 1 to 2 GB, even more, (OK with my modification, but others filters do the same)

Rod wrote:
Can't be because of hard drive space as i have 42 GB of that.

If i recall, or it's something my mind made up (if so, my following sentence is all BS), the swap (by default) is the size of the RAM or double the RAM, thus it won't use the 42 GB... unless you physically made the swap this size. And if you drive is a HDD, what's its spin 5.4k or 7.2k?! it's very-very slow compared to a SDD.
G'MIC might throw error because it's too long (this latest sentence, though, I'm sure is all BS :mrgreen: )

_________________
Patrice


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Wed Sep 21, 2022 2:19 pm  (#23) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Rod wrote:
[...]now i have no nifty design[...]
I've just added an option to the "Dimensions" parameter: "According to Layer (Scaling)".
(If you choose "Proportionate" or "Scaling", the big circle radius is a percentage of 1/3 of the smaller dimension of the layer. Otherwise, it's a number of pixels.)
Is the error still present with this option ?

PixLab wrote:
Is it possible to give an option to not show the external big circle?
Yes, I've just added a "Draw Big Circle" parameter.

PixLab wrote:
Is it possible to have an alpha channel on the colors?
Yes, it would be but what do you want to do with alpha channel?

Here is the new code:
cl_circ_prerelease :
   # $1 : center x-coordinate
   # $2 : center y-coordinate
   # $3 : radius
   # $4 : stroke width

   fill. stroke(d)=cut($4-abs(d/2),0,1);stroke(sqrt((x-$1)^2+(y-$2)^2)-$3)
   n. 0,255

cl_innerCirc_prerelease :

   xC=$1 # center x-coordinate
   yC=$2 # center y-coordinate
   radi=$3 # big circle radius
   wid=$4 # stroke width
   nb=$5 # number of small circles
   lvl=$6 # number of levels

   if $lvl>0
      angl={pi/$nb}
      sinu={sin($angl)}
      ra={$radi/(1+1/$sinu)}
      ray={$radi/(1+$sinu)}
      
      +fill. 0
      [-1]x{$nb-1}
      foreach[1--1] {
         num=$>
         xA={$ray*cos(2*$num*$angl)}
         yA={$ray*sin(2*$num*$angl)}
         cl_circ_prerelease {$xC+$xA},{$yC+$yA},$ra,$wid
         cl_innerCirc_prerelease {$xC+$xA},{$yC+$yA},$ra,$wid,$nb,{$lvl-1}
      }
   fi

#@gui ____<b>Rendering</b>
#------------------
#@gui Tangential Circles (prerelease): cl_tangentialCircle_prerelease, cl_tangentialCircle_prerelease(1)
#@gui : note = note("<small>Warning: This is a slow filter and it might consume too much RAM.</small>")
#@gui : sep = separator()
#@gui : note = note("<b>Drawing:</b>")
#@gui : Draw Big Circle = bool(1)
#@gui : Big Circle Radius = float(100, 10, 1000)
#@gui : Dimensions = choice[0, "According to Radius", "According to Layer", "According to Layer (Proportionate)", "According to Layer (Scaling)"]
#@gui : note = note("<small>If you choose "proportionate" or "Scaling", the Big Circle Radius is a percentage of 1/3 of the smaller dimension of the layer. Otherwise, it is a number of pixels.</small>")
#@gui : Stroke Width = float(1,0.5,10)
#@gui : Number of Small Circles = int(5, 2, 100)
#@gui : Number of Levels = int(1, 1, 4)
#@gui : sep = separator()
#@gui : note = note("<b>Colors:</b>")
#@gui : Background Color = color(255,255,255)
#@gui : Foreground Color = color(0,0,0)
#@gui : sep = separator()
#@gui : note = note("<b>Effects:</b>")
#@gui : Effect = choice(0, "None", "Transparent Background", "Strange Polygons", "Multicolored", "Rainbow", "Double", "Colored Tube", "Red-Yellow Halo", "Blue-Cyan Halo")
#@gui : sep = separator()
#@gui : note = note("<small>Note: The preview might be much more aliased than the final result and some effects ignore colors.</small>")
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>. Latest Update: <i>2022/09/21</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé and Rod/GimpChat and an algorithm of Reptorian.</small>")

cl_tangentialCircle_prerelease:

   showBig,radi,dime,wid,nb,lvl,backR,backG,backB,foreR,foreG,foreB,effect=$*

   grow=3
   dimens={$radi*$grow}

   rectWid={if($dime==1||$dime==2,w,$dimens)}
   rectHei={if($dime==1||$dime==2,h,$dimens)}
   chanNumb={if($effect,4,3)}
   $rectWid,$rectHei,1,$chanNumb,255
   radius={if($dime==2,$radi/300*min(w,h),$radi)}

   local.

      xC={w/2} # center x-coordinate
      yC={h/2} # center y-coordinate

      if $effect==1
         backR,backG,backB=$foreR,$foreG,$foreB
      elif $effect>=7
         backR,backG,backB=255,255,255
         foreR,foreG,foreB=0,0,0
      fi

      foreA=255
      backA={if($effect==1,0,255)}

      if $showBig==1
         cl_circ_prerelease. $xC,$yC,$radius,$wid
      else
         n. 0,255
      fi
      
      cl_innerCirc_prerelease. $xC,$yC,$radius,$wid,$nb,$lvl

      blend screen,1

      n. 0,1
      
      if $effect<=1
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
      elif $effect==2
         fx_rodilius. 15,1,0,$nb,90,0,1,0,0
         n. 0,1
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
         n. 0,255
      elif $effect==3
         fx_curvature 10,0,100,0,0
         fx_gradient2rgb 0,0,100,0,0
         apply_curve 1,0,0,16,240,255,255
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
      elif $effect==4
         fx_dog 1.4,1.5,0,0,0
         fx_gradient2rgb 0,0,100,0,0
         apply_curve 1,0,0,64,192,255,255
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
      elif $effect==5
         dog. 1.4,1.5
         n. 0,255
      elif $effect==6
         fx_dog. 1.4,1.5,0,0,0
         apply_curve. 1,0,0,16,0,255,255
         cut. 0,255
         
         fx_distance. 0,2,1,0
         negate. [-1] [-1]
         fx_decompose_channels 8,1,1,0
         l.
            # inspired by emboss_image of Reptorian
            +apply_curve. 1,0,0,240,16,255,255
            l.
               b. 2.5
               gradient2rgb. 0 n. 0,255
               [-1]
               rgb2hsv[-2,-1] split[-2,-1] c
         
               l[-3--1] +[-3] {315} %[-3] 360 done
               l[-6--4] +[-3] {135} %[-3] 360 done
               l[-3--1] a c hsv2rgb s c done
               l[-6--4] a c hsv2rgb s c done
               rm[^-6,-3]
               negate..
               / 2
               +. 128
               blend grainmerge,1
            done
            to_rgb
            blend grainmerge,1
         done
         
         fx_smooth_antialias. 15,0,1,0,50,50
         fx_smooth_antialias. 50,50,2.5,0,50,50
         sharpen 300
      elif $effect>=7
         fill. [i*$foreR+(1-i)*$backR,i*$foreG+(1-i)*$backG,i*$foreB+(1-i)*$backB,i*$foreA+(1-i)*$backA]
         remove_opacity.
         split. c rm. rm..
         +fx_morphological. 0,2,10,"1,0,1; 0,1,0; 1,0,1",0,0,0,0
         +fx_morphological. 0,2,20,"1,0,1; 0,1,0; 1,0,1",0,0,0,0
         if $effect==8 reverse[-3,-1] fi
         a c
      fi
   
   done
   
   mv[-1] 0
   if $dime==3 resize[0] {min(w,h)/3}%,{min(w,h)/3}%,1,$chanNumb,5 fi


_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Wed Sep 21, 2022 2:58 pm  (#24) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
I would suggest to use mathematical expression under fill or eval to do this:

`ellipse(_#ind,xc,yc,-radius1,-_radius2,_angle,_opacity,_pattern,_color) draws an outlined ellipse in image [ind] (or in default image selected if ind is not specified).`

Perhaps with dynamic array that specifies x-location, y-location,radius, stroke size, and then use the above. It would make your script so much faster.


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Thu Sep 22, 2022 3:33 am  (#25) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Quote:
I've just added an option to the "Dimensions" parameter: "According to Layer (Scaling)".
(If you choose "Proportionate" or "Scaling", the big circle radius is a percentage of 1/3 of the smaller dimension of the layer. Otherwise, it's a number of pixels.)
Is the error still present with this option ?


Yes
Attachment:
TC-Error_RD-2022-09-22_032841.jpg
TC-Error_RD-2022-09-22_032841.jpg [ 114.87 KiB | Viewed 717 times ]

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Thu Sep 22, 2022 8:33 am  (#26) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 775
Location: SEA - South East Asia
cli345 wrote:
PixLab wrote:
Is it possible to have an alpha channel on the colors?
Yes, it would be but what do you want to do with alpha channel?

That was just a thought, I thought I could apply a filters before yours in G'MIC, then applying yours with some transparencies to smooth the blend ;)
Not sure if it's really useful, it was just a thought :oops:

In all cases, Thank you so much for the update, that's awesome :clap (I hope it will become an official filter)
:tyspin

Image

A deviation :mrgreen:
Image

_________________
Patrice


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 24, 2022 12:27 am  (#27) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
I'm making an attempt at this filter with my own twist to it. It'll use way less memory, and be much faster.


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 24, 2022 6:21 am  (#28) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2020
Posts: 338
Location: The Netherlands
Sorry to ask, but don't quite understand how to put this in G'mic. This is my first time with a G'mic filter/plugin.


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 24, 2022 11:14 am  (#29) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Jappaloe63 wrote:
Sorry to ask, but don't quite understand how to put this in G'mic. This is my first time with a G'mic filter/plugin.


Copy the revealed text (CODE) into your user.gmic file. Open Notepad or any text editor and paste it into a file, save as user.gmic. Place the user.gmic file into specified location: Windows folk, that usually resolves to something like C:\Users\<yourwindowsaccountname>\AppData\Roaming\user.gmic, where you replace <yourwindowsaccountname> with your Windows user account name (without angle brackets, no quotes). Note: "usually," because your specific Windows installation may vary from the norm. On Windows 10, you may paste the Windows symbolic name %AppData% in the search bar and File Explorer will open the relevant folder for you. See Where to Find the AppData Folder in Windows 10 by Vijit Ail. Linux and MacOS users would append the revealed text to their $HOME/.gmic file. Make a backup of your gmic user file first, just in case mistakes happen. If you don't have a user.gmic .gmic, then create one from scratch to contain the revealed text. You now have your very first personal G'MIC command.

Refresh GMIC.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 24, 2022 11:24 am  (#30) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi Ineke!
Ok.
1. Copy and paste the code into Notepad or Notepad++
2. Save the the file and re-name it to, user.gmic (Place it in the location: C:\Users\YourName or User\AppData\Roaming user.gmic)
3. If you already have G'MIC opened, click on the refresh button on the bottom left. You should find the filter in: Render/Tangential Circle(Prerelease)
Image

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 24, 2022 11:32 am  (#31) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2020
Posts: 338
Location: The Netherlands
Thank you Mahvin & Pocholo...
it's clear to me now


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sun Jan 22, 2023 3:55 pm  (#32) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Now, this filter is in G'MIC (version 3.2.0).

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts I hope you like circles.

14

No new posts Spin-art Grid kind'a like Kandinsky's circles but for any image

1

No new posts Attachment(s) cli345's cartoon filter as a native GEGL Filter.

10

No new posts Found a 'new' (for me) Filter

0

No new posts Attachment(s) what filter might help with this image?

7



* Login  



Powered by phpBB3 © phpBB Group