It is currently Thu Jul 04, 2024 3:09 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: New G'MIC filter "Tangential Circles"
PostPosted: Fri Sep 16, 2022 11:24 am  (#1) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Hello! :)

Inspired by this message, I intend to propose a new G'MIC filter "Tangential Circles".
With default parameters, it would give:
Attachment:
tangentialCircles_1b.jpg
tangentialCircles_1b.jpg [ 9.42 KiB | Viewed 2289 times ]

With default parameters except that "Number of Levels = 2, Effect = Blue-Cyan Halo", it would give:
Attachment:
tangentialCircles_2b.jpg
tangentialCircles_2b.jpg [ 34.9 KiB | Viewed 2289 times ]

With default parameters except that "Big Circle Radius = 150, Stroke Width = 2, Number of Levels = 2, Effect = Colored Tube", it would give:
Attachment:
tangentialCircles_3b.jpg
tangentialCircles_3b.jpg [ 102.23 KiB | Viewed 2289 times ]


Here is its 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.</small>")
#@gui : sep = separator()
#@gui : note = note("<b>Drawing:</b>")
#@gui : Big Circle Radius = float(100, 10, 500)
#@gui : Stroke Width = float(1,0.5,10)
#@gui : Number of Small Circles = int(5, 2, 20)
#@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,wid,nb,lvl,backR,backG,backB,foreR,foreG,foreB,effect=$*

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

   if $effect==1
      $biggerRadi,$biggerRadi,1,4,255
   else
      $biggerRadi,$biggerRadi,1,3,255
   fi

   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


Installation:
  • Copy and paste the above code into the file "~/.gmic" on Linux or the file "%APPDATA%\user.gmic" on Windows.
  • The new filter appears in "Filters -> G'MIC -> Rendering -> Tangential Circles (prerelease)".

Have fun! :)

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


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: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 17, 2022 1:49 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nice addition to G'MIC! :bigthup Thx.

cl_tangentialCircle_prerelease 90.2,1.095,10,3,0,0,0,0,85,0,2


Attachment:
GMIC-Circles_RD.png
GMIC-Circles_RD.png [ 32.6 KiB | Viewed 2240 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: Sat Sep 17, 2022 2:04 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
cl_tangentialCircle_prerelease 95.1,0.905,12,3,0,0,0,0,85,0,4


Attachment:
GMIC-Circles-RB_RD.png
GMIC-Circles-RB_RD.png [ 104.72 KiB | Viewed 2237 times ]


How do i insure the created image is my layer size? The image seems to crop itself to a certain width and length.

_________________
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: Sat Sep 17, 2022 2:06 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Looks cool; you probably made the Mandela lovers very happy with this one. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sat Sep 17, 2022 12:53 pm  (#5) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
What am I missing on how this filter is used? The layer arrangement produced at default places the result under the background image. Weird. I'll check it this time.

_________________
"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 17, 2022 2:24 pm  (#6) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Thanks Rod, lylejk, mahvin for your valuable feedback! :tyspin

Mahvin, for now, I can't reproduce your bug. What happens when you delete the last line of the code "mv[-1] 0" ?

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


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sun Sep 18, 2022 1:23 am  (#7) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
cli345 wrote:
Thanks Rod, lylejk, mahvin for your valuable feedback! :tyspin

Mahvin, for now, I can't reproduce your bug. What happens when you delete the last line of the code "mv[-1] 0" ?


Actually, I was missing the last line of code, and once added, it worked fine. However, like Rod asked, I'm curious how we can get the result to convert to the layer size we decide to use, since the display is rendering at 300px square.

_________________
"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: Sun Sep 18, 2022 7:50 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
mahvin wrote:
cli345 wrote:
Thanks Rod, lylejk, mahvin for your valuable feedback! :tyspin

Mahvin, for now, I can't reproduce your bug. What happens when you delete the last line of the code "mv[-1] 0" ?


Actually, I was missing the last line of code, and once added, it worked fine. However, like Rod asked, I'm curious how we can get the result to convert to the layer size we decide to use, since the display is rendering at 300px square.


I wonder if that has to do with the Big Circle Radius setting?

_________________
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: Sun Sep 18, 2022 8:01 am  (#9) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Rod wrote:
How do i insure the created image is my layer size?
mahvin wrote:
...how we can get the result to convert to the layer size we decide to use...
I've just added a "Dimensions" parameter: Choose "According to Layer".
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.</small>")
#@gui : sep = separator()
#@gui : note = note("<b>Drawing:</b>")
#@gui : Big Circle Radius = float(100, 10, 500)
#@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, 20)
#@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


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


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Sun Sep 18, 2022 9:05 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
cli345 wrote:
Rod wrote:
How do i insure the created image is my layer size?
mahvin wrote:
...how we can get the result to convert to the layer size we decide to use...
I've just added a "Dimensions" parameter: Choose "According to Layer".
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.</small>")
#@gui : sep = separator()
#@gui : note = note("<b>Drawing:</b>")
#@gui : Big Circle Radius = float(100, 10, 500)
#@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, 20)
#@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


Thank You! :bigthup

I was able to create a 375x375 circle by multiplying the # levels by Big Circle Radius. 3x125
I set my layer width and height to 375 and ran the filter with levels at 3 and Big Circle Radius at 125 and got an image very quickly. Exactly the width and height of my layer.
This computation cannot be correct however because i ran the filter with 3 levels and 500 Big Circle Radius on a 1500x1500 radius and got an error.

So i am not sure why it was not allowing those parameters.

Thanks for the update! :hi5

Quote:
*** Error in ./cl_tangentialCircle_prerelease/ *** Command 'local': [instance(0,0,0,0,0000000000000000,non-shared)] gmic<float32>::assign(): Failed to allocate memory (15.3 Mio) for image (1000,1000,1,4).


For these settings
cl_tangentialCircle_prerelease 100,1,1,10,3,0,0,0,0,85,0,2

_________________
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: Sun Sep 18, 2022 9:17 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Odd though that running with preview on works in the filter,

Attachment:
T-Circles-Preview-1_RD-2022-09-18_100623.jpg
T-Circles-Preview-1_RD-2022-09-18_100623.jpg [ 242.54 KiB | Viewed 1906 times ]


but when i try to render the image (click Apply, Or OK).

Attachment:
T-Circles-Preview-2_RD-2022-09-18_100623.jpg
T-Circles-Preview-2_RD-2022-09-18_100623.jpg [ 242.45 KiB | Viewed 1906 times ]


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
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: Sun Sep 18, 2022 9:26 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
And when i try to run these settings using according to radius i get this error window with a 1500x1500 image size..
cl_tangentialCircle_prerelease 500,0,1,10,3,0,0,0,0,85,0,2


Attachment:
T-Circles-Preview-3_RD-2022-09-18_100623.jpg
T-Circles-Preview-3_RD-2022-09-18_100623.jpg [ 238.47 KiB | Viewed 1906 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: Sun Sep 18, 2022 9:38 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Ok i think i may have figured it out.
I reset the values of the filter.
I selected according to layer--no problem
I selected 10 for small circles
I selected 1 for levels no problem
I selected 2 for levels, no problem.

As soon as i selected 3 for levels G'MIC crashed.
Must be in the levels settings?

_________________
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: Sun Sep 18, 2022 9:50 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nope! 2 on levels with a 1500x1500 image i get this.

Attachment:
T-Circles-Preview-4_RD-2022-09-18_100623.jpg
T-Circles-Preview-4_RD-2022-09-18_100623.jpg [ 127.74 KiB | Viewed 1903 times ]


Setting levels to 1 however...
Attachment:
T-Circles-Preview-5_RD-2022-09-18_100623.jpg
T-Circles-Preview-5_RD-2022-09-18_100623.jpg [ 34.06 KiB | Viewed 1903 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: Sun Sep 18, 2022 1:54 pm  (#15) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Just to illustrate the "Number of Levels" parameter:
Attachment:
tangentialCircles_level.jpg
tangentialCircles_level.jpg [ 48.33 KiB | Viewed 1890 times ]


With the "Dimensions" parameter set to "According to Radius", the width and height of the result are three times the radius. For now, this "three" factor is fixed (enough to let the effects go beyond the big circle):
Attachment:
tangentialCircles_dimensions.jpg
tangentialCircles_dimensions.jpg [ 13.83 KiB | Viewed 1890 times ]


@Rod
Yes, for now, my filter is not optimized and it consumes a lot of CPU and RAM.
I think I'll probably have to trace all the circles with a single 'fill' instruction.

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


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Tue Sep 20, 2022 12:53 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
cli345 wrote:
Just to illustrate the "Number of Levels" parameter:
Attachment:
tangentialCircles_level.jpg


With the "Dimensions" parameter set to "According to Radius", the width and height of the result are three times the radius. For now, this "three" factor is fixed (enough to let the effects go beyond the big circle):
Attachment:
tangentialCircles_dimensions.jpg


@Rod
Yes, for now, my filter is not optimized and it consumes a lot of CPU and RAM.
I think I'll probably have to trace all the circles with a single 'fill' instruction.

I still don't understand using just 1 level of circles it works but is very small compared to the layer size.

_________________
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: Tue Sep 20, 2022 5:27 am  (#17) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
I think I get it now. :)

I've just added an option to the "Dimensions" parameter: "According to Layer (Proportionate)".
If you choose "Proportionate", the big circle radius is a percentage of 1/3 of the smaller dimension of the layer. Otherwise, it's a number of pixels.

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 : Big Circle Radius = float(100, 10, 500)
#@gui : Dimensions = choice[0, "According to Radius", "According to Layer", "According to Layer (Proportionate)"]
#@gui : note = note("<small>If you choose "proportionate", 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, 20)
#@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
   dimens={$radi*$grow}

   rectWid={if($dime,w,$dimens)}
   rectHei={if($dime,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)}

      cl_circ_prerelease. $xC,$yC,$radius,$wid
      
      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


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


Top
 Post subject: Re: New G'MIC filter "Tangential Circles"
PostPosted: Tue Sep 20, 2022 10:43 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
cli345 wrote:
I think I get it now. :)

I've just added an option to the "Dimensions" parameter: "According to Layer (Proportionate)".
If you choose "Proportionate", the big circle radius is a percentage of 1/3 of the smaller dimension of the layer. Otherwise, it's a number of pixels.

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 : Big Circle Radius = float(100, 10, 500)
#@gui : Dimensions = choice[0, "According to Radius", "According to Layer", "According to Layer (Proportionate)"]
#@gui : note = note("<small>If you choose "proportionate", 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, 20)
#@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
   dimens={$radi*$grow}

   rectWid={if($dime,w,$dimens)}
   rectHei={if($dime,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)}

      cl_circ_prerelease. $xC,$yC,$radius,$wid
      
      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


Sorry. With these settings i still get an error. :(
cl_tangentialCircle_prerelease 100,2,1,10,3,255,255,255,0,0,0,0


Attachment:
2022-09-20_113707.jpg
2022-09-20_113707.jpg [ 233.42 KiB | Viewed 1847 times ]


Has to be my RAM output. :(

_________________
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: Tue Sep 20, 2022 10:50 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
As long as i use 1 level it works. But now i have no nifty design. :gaah :hoh
cl_tangentialCircle_prerelease 100,2,1,10,1,0,0,0,0,85,0,2

_________________
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: Tue Sep 20, 2022 10:55 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Attachment:
TEST_RD-TCircles.png
TEST_RD-TCircles.png [ 186.39 KiB | Viewed 1847 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 new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
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

No new posts Attachment(s) My last Aquarelle filter

21



* Login  



Powered by phpBB3 © phpBB Group