It is currently Sun Jun 30, 2024 1:23 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: New G'MIC filter "Color Wheel"
PostPosted: Thu Jan 25, 2024 7:35 am  (#1) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Hello and happy new year 2024! :)

Inspired by this thread, I intend to propose a new G'MIC filter "Color Wheel".

With default parameters, it would give:
Attachment:
colorWheel1.jpg
colorWheel1.jpg [ 31.3 KiB | Viewed 1071 times ]

With default parameters except that "Internal Circle Radius Percentage = 1, Type = Opponent Model", it would give:
Attachment:
colorWheel_1_1_OM.jpg
colorWheel_1_1_OM.jpg [ 29.21 KiB | Viewed 1071 times ]

With default parameters except that "Internal Circle Radius Percentage = 50, Parts = x3, Type = Red-Yellow-Blue Model", it would give:
Attachment:
colorWheel_50_3_RYB.jpg
colorWheel_50_3_RYB.jpg [ 34.72 KiB | Viewed 1071 times ]

Here is its code:
#@gui Color Wheel (prerelease): cl_colorWheel_prerelease, cl_colorWheel_prerelease(0)
#@gui : note = note("Warning: This is an enormously gross approximation of the color models.")
#@gui : note = note("<b>Dimension:</b>")
#@gui : External Circle Radius = float(200, 10, 1000)
#@gui : Internal Circle Radius Percentage = float(80, 1, 99)
#@gui : Parts = choice[0, "x1", "x2", "x3", "x4", "Continuous"]
#@gui : sep = separator()
#@gui : note = note("<b>Colors:</b>")
#@gui : Type = choice[0, "Red-Green-Blue Model", "Red-Yellow-Blue Model", "Opponent Model"]
#@gui : sep = separator()
#@gui : note = note("<b>Rotation:</b>")
#@gui : Inverse Order = bool(0)
#@gui : Rotation = float(0, 0, 360)
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>. Latest Update: <i>2024/01/23</i>.</small>")

cl_colorWheel_prerelease:
   
   extCircle,intCirclePercent,parts,type,invert,rot=$*
   
   wid={$extCircle*2.5}
   hig=$wid
   intCircle={$extCircle*$intCirclePercent/100}
   
   if $type==2
      base=2
   else
      base=3
   fi
   
   if $parts<=3
      mult={$parts+1}
   else
      mult=60
   fi
   
   nbParts={$base*$mult}

   if $type==0
      formula="ang"
   elif $type==1
      formula="if(ang<120,ang/2,if(ang<180,ang-60,if(ang<240,ang*2-240,ang)))"
   elif $type==2
      formula="if(ang<180,ang*2/3,ang*4/3-120)"
   fi

   $wid,$hig,1,1
   
   local.
      fill. "r = sqrt((x-w/2)^2+ (y-h/2)^2);
         ang=atan2(y-h/2,x-w/2);
         "angd=((1-2*$invert)*ang-$rot*pi/180+pi);"
         "ang=(angd/2/pi-floor(angd/2/pi))*2*pi-pi;"
         "angp=$nbParts*ang/pi+0.5;"
         "rnd=floor(angp);"
         "frc=angp-rnd;"
         "ang=(rnd-1+cut(frc*r*pi/$nbParts,0,1))*pi/$nbParts;"
         ang=180*ang/pi+180;
         "ang=$formula;"
         "($intCircle<r&&r<$extCircle)*ang"
      "
      $wid,$hig,1,1,1
      $wid,$hig,1,1,1
      $wid,$hig,1,1,1
      fill. "r = sqrt((x-w/2)^2+ (y-h/2)^2);
         "cut(r-$intCircle,0,1)*cut($extCircle-r,0,1)*255"
      "
      a c
      hsv2rgb.
   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 -> Color Wheel (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 "Color Wheel"
PostPosted: Thu Jan 25, 2024 3:45 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
That looks like fun!
Planning on moving it into gmic-community/include/claude_lion.gmic?


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Thu Jan 25, 2024 3:52 pm  (#3) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Yes! Thanks for your kind comment! :)

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


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Fri Jan 26, 2024 4:19 pm  (#4) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
Reminds me of a lot of this filter I made called "Color Harmonies":

Image

It probably needs refactoring like the other filters I am refactoring slowly over time as in I only do G'MIC stuff on the weekend.


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Fri Jan 26, 2024 4:50 pm  (#5) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Your filter seems excellent to me :bigthup. Maybe, it would be better placed in the "Colors" category! :)

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


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Tue Jan 30, 2024 3:05 pm  (#6) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
Just checking in, how's the filter going so far?


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Sun Feb 25, 2024 10:51 am  (#7) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
For me, it works well: I get the various related colors to make a color harmony. :)

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


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Sun Feb 25, 2024 8:02 pm  (#8) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
cli345 wrote:
For me, it works well: I get the various related colors to make a color harmony. :)

Great! When you make a pull request, I'm be sure to approve it.


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Tue Mar 12, 2024 11:35 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 787
Location: SEA - South East Asia
Nice wheel cli345 :clap
I added this code below on top of your code, as I have some code before in my "~/.gmic" and your wheel was in "Deformations" due to the code above :hehe
#@gui ____<b>Colors</b>
#------------------
#@gui Color Wheel (prerelease): cl_colorWheel_prerelease, cl_colorWheel_prerelease(0)
#@blablabla....

If I may, the only thing is that the result does not respect the size of the canvas, that would be a plus+ if the result would be on a layer of the canvas size (G'MIC 3.3.5 / GIMP 2.10.36 ), anyway it's very nice, thank you :tyspin

EDIT: forget what I said about the canvas size, I moved the External Circle Radius slider... and result get bigger :bigthup (sorry, I was asleep :oops: )
Attachment:
screenshot_20240313-122725.jpg
screenshot_20240313-122725.jpg [ 67.5 KiB | Viewed 605 times ]

_________________
Patrice


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Wed Mar 13, 2024 1:28 pm  (#10) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Thank you, PixLab :). Indeed, I've forgotten to include the category.

As it builds a new stuff, I believed that the best category is "Rendering" but maybe I should put it into "Colors".

What do you think about it? "Rendering" or "Colors"?

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


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Wed Mar 13, 2024 11:30 pm  (#11) 
Offline
GimpChat Member

Joined: Oct 16, 2017
Posts: 41
Rendering because filters within Colors still retain spatial structure. Retaining spatial structure means you can see the earlier image.


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Thu Mar 14, 2024 4:00 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 787
Location: SEA - South East Asia
Hi cli345,
Um... now that you mention "Rendering" (which it does), I don't know, because it's color.... but rendered :hehe
In the end Reptorian and You are right IMHO, "Rendering" is certainly the best category :bigthup

_________________
Patrice


Top
 Post subject: Re: New G'MIC filter "Color Wheel"
PostPosted: Fri Mar 15, 2024 9:08 am  (#13) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
OK, Thanks. I'm going to make the pull request.

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


Top
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) use of a color curves preset in a python filter

42

No new posts Mandala/Spin-wheel Drawings

3

No new posts New GEGL filter that inverts transparency and allows a color fill

2

No new posts Attachment(s) GEGL Color Light Fusion (12 blend modes for color overlay)

9

No new posts Attachment(s) Background color chanage and typed text color change

8



* Login  



Powered by phpBB3 © phpBB Group