GIMP Chat
http://gimpchat.com/

New G'MIC filter "Frame [Relief]"
http://gimpchat.com/viewtopic.php?f=28&t=20005
Page 1 of 2

Author:  cli345 [ Sun Jul 03, 2022 11:44 am ]
Post subject:  New G'MIC filter "Frame [Relief]"

Hello! :)

I intend to propose a new G'MIC filter "Frame [Relief]".
With default parameters, it would give these results:
Attachment:
examples_reliefFrame.jpg
examples_reliefFrame.jpg [ 122.05 KiB | Viewed 2561 times ]
With default parameters except that "Type = Groove, Kaleidoscope unchecked, Frame Blur = 5, Frame Hue Change = 180, Graininess Amount = 7", it would give:
Attachment:
examples_reliefFrame2.jpg
examples_reliefFrame2.jpg [ 169.62 KiB | Viewed 2561 times ]
With default parameters except that "Type = Outset, Relief Amount = 50, Kaleidoscope unchecked, Frame Blur = 10, Frame Saturation Change = -1, Graininess Amount = 7", it would give:
Attachment:
examples_reliefFrame4.jpg
examples_reliefFrame4.jpg [ 161.8 KiB | Viewed 2561 times ]

Here is its code:
#@gui ____<b>Frames</b>
#------------------
#@gui Frame [Relief] (prerelease): cl_reliefFrame_prerelease, cl_reliefFrame_prerelease(1)
#@gui : note = note("<b>Frame Limit:</b>")
#@gui : Type = choice(1, "Outset", "Inset", "Groove", "Ridge")
#@gui : Size = float(10,6,20)
#@gui : Relief Width = float(1.5,0,10)
#@gui : Relief Amount = float(75,0,127)
#@gui : sep = separator()
#@gui : note = note("<b>Frame Area:</b>")
#@gui : Kaleidoscope Effect = bool(1)
#@gui : Frame Blur = float(60,5,80)
#@gui : Frame Hue Change = float(0,-180,180)
#@gui : Frame Saturation Change = float(0,-1,1)
#@gui : Frame Luminosity Change = float(0,-0.5,0.5)
#@gui : sep = separator()
#@gui : note = note("<b>Graininess:</b>")
#@gui : Graininess Type = choice("Gaussian", "Uniform", "Poisson")
#@gui : Graininess Amount = float(0,0,80)
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>.      Latest Update: <i>2022/07/01</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé.</small>")

cl_reliefFrame_prerelease:
   
   frameType,frameSize,reliefWidth,reliefAmount,kaleido,frameBlur,frameHue,frameSat,frameLum,grainType,grainAmount=$*
   
   if $grainType==2
      grainType=3
   fi
   
   foreach {
      
      [-1]
      if $kaleido
         fx_kaleidoscope. 50,50,0,0,100,10,2
      fi
      b. $frameBlur
      
      l.
         rgb2hsl split c
         +. $frameLum c. 0,1
         +.. $frameSat c.. 0,1
         +... $frameHue %... 360
         a c hsl2rgb
      done
      
      100%,100%,1,1,0
      fx_frame_round. $frameSize,20,1,255,255,255,255,0,0,3
      remove_opacity.
      n. 0,255
      
      [-1]
      
      if $frameType>=1 # inset, groove, ridge
         negate.
      fi
      
      if $frameType>=2 # groove, ridge
         gradient_norm.
      fi
      
      if $frameType==3 # ridge
         negate.
      fi
      
      fx_smooth_antialias. 100,10,5,0,50,50
      
      negate.
      


      l.
         # inspired by emboss_image of Reptorian
         b. $reliefWidth
         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.
      
      apply_curve. 1,0,{127-$reliefAmount},255,{128+$reliefAmount}
      
      fill[0] i#2*i#1+(255-i#2)*i n[0] 0,255
      rm.. rm..
      
      blend grainmerge,1
      fx_noise. $grainAmount,$grainType,16,1,0,50,50

   }


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 -> Frames -> Frame [Relief] (prerelease)".

Have fun! :)

Author:  MareroQ [ Sun Jul 03, 2022 1:06 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hi Claude.
Thanks for the new filter. :bigthup
My favorite is the Groove type.

Attachments:
Frame Groove.jpg
Frame Groove.jpg [ 132.95 KiB | Viewed 2535 times ]

Author:  gimpmannew [ Sun Jul 03, 2022 1:50 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Windows 7 GIMP 2.8 I copied and pasted the code in note pad, saved to desktop. By default the extension is txt. I put it in the folder it says app data GMIC. It did not show. I then changed the extension to py and it also did not show. If someone could help.... Thank you.

Author:  MareroQ [ Sun Jul 03, 2022 2:34 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

You need to change the extension from user.txt to user.gmic.
I don't know if Windows 7 will be the same.
In Windows 10, the correct (my) location is:
c:\Users\***\AppData\Roaming\user.gmic
(doesn't work from a location that seems more logical:
c:\Users\***\AppData\Roaming\gmic\user.gmic)

For Samj portable:
d:\Gimp-2.10.32_Portable_Samj_32-64bit-Win\GMIC_Filters\user.gmic
(but NO: d:\Gimp-2.10.32_Portable_Samj_32-64bit-Win\GMIC_Filters\gmic\user.gmic)

*** = Your 'name' from the login to the system {your_id}

Author:  mahvin [ Mon Jul 04, 2022 11:07 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

This may seem a little odd, I ran into the same problem when trying to save the user.gmic to Roaming directly from Notepad. It never showed up because the system could not recognize the filetype association and requesting an app to associate it. So, I had to trick Windows into recognizing it as a gmic file by saving it to Roaming/gmic, before moving it to Roaming. Only then, did it work. Odd, but true.

Author:  PixLab [ Mon Jul 04, 2022 11:16 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

I got some problems.... especially with the "Relief Width" slider
Same problem whatever G'MIC for GIMP or the G'MIC stand alone, all my G'MIC are downloaded from gmic.eu
MX Linux 21.1 / G'MIC 3.1.5

Default settings... what is this rectangle?
Image

others problems > getting all dark
Image

what kind of effect is this?
Image

moving only 1 slider from default setting....
Image

G'MIC stand alone, 1 example (getting dark) but got ALL the very same problems as with G'MIC for GIMP
Image

Image is from pexels.com I "zipped" it here to be sure the GC's website will not modify it
Attachment:
pexels-photo-358457.jpeg.7z [676.04 KiB]
Downloaded 46 times


In case you got any doubt about where I did put it
Attachment:
ksnip_20220705-123646.png
ksnip_20220705-123646.png [ 59.33 KiB | Viewed 2423 times ]

Author:  cli345 [ Tue Jul 05, 2022 11:56 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Thanks MareroQ, gimpmannew, mahvin, PixLab for your valuable feedback. :tyspin

PixLab, I can't reproduce your problems.
Have you put the code into an empty '.gmic' file ? It's not mandatory but I've already had a problem because of the preceding code!
Do other users have the same problems ?

Author:  cli345 [ Tue Jul 05, 2022 12:41 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

PixLab, I just succeeded to reproduce your first problem in Krita.
I'm going to investigate it.

Author:  PixLab [ Tue Jul 05, 2022 9:51 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

cli345 wrote:
Have you put the code into an empty '.gmic' file ? It's not mandatory but I've already had a problem because of the preceding code!

Indeed, there is only your code. The .gmic was created just for your code :bigthup

cli345 wrote:
PixLab, I just succeeded to reproduce your first problem in Krita.
I'm going to investigate it.

I feel relieved now, I got scared that I was alone :mrgreen:
In case it helps, I have the same problem with the appImage GIMP 2.10.25 from the continuous release of aferrero "GIMP_AppImage-git-2.10.25-20210610-withplugins-x86_64.AppImage" (G'MIC 3.1.5, same G'MIC as the distro's GIMP which is GIMP 2.10.28)>> https://github.com/aferrero2707/gimp-ap ... continuous

Just moving only the "Relief Width" slider to the right will show inconsistency and different effect further away I move it step by step. Like getting all dark and or having suddenly the huge "bumps?", then all dark again further away to the right I move this slider.

Moving the "Relief Width" slider to the left from default setting, make the picture brighter, and the "white" rectangle larger but thinner
Hope this helps

Thanks a lot cli345 for your answers and your time :tyspin

Author:  cli345 [ Tue Jul 26, 2022 11:44 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hello, :)

Thanks to David Tschumperlé (issue 402), I think I have fixed the bug.
#@gui ____<b>Frames</b>
#------------------
#@gui Frame [Relief] (prerelease): cl_reliefFrame_prerelease, cl_reliefFrame_prerelease(1)
#@gui : note = note("<b>Frame Limit:</b>")
#@gui : Type = choice(1, "Outset", "Inset", "Groove", "Ridge")
#@gui : Size = float(10,6,20)
#@gui : Relief Width = float(1.5,0,10)
#@gui : Relief Amount = float(75,0,127)
#@gui : sep = separator()
#@gui : note = note("<b>Frame Area:</b>")
#@gui : Kaleidoscope Effect = bool(1)
#@gui : Frame Blur = float(60,5,80)
#@gui : Frame Hue Change = float(0,-180,180)
#@gui : Frame Saturation Change = float(0,-1,1)
#@gui : Frame Luminosity Change = float(0,-0.5,0.5)
#@gui : sep = separator()
#@gui : note = note("<b>Graininess:</b>")
#@gui : Graininess Type = choice("Gaussian", "Uniform", "Poisson")
#@gui : Graininess Amount = float(0,0,80)
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>.      Latest Update: <i>2022/07/01</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé.</small>")

cl_reliefFrame_prerelease:
   
   frameType,frameSize,reliefWidth,reliefAmount,kaleido,frameBlur,frameHue,frameSat,frameLum,grainType,grainAmount=$*
   
   if $grainType==2
      grainType=3
   fi
   
   foreach {
     
      [-1]
      if $kaleido
         fx_kaleidoscope. 50,50,0,0,100,10,2
      fi
      b. $frameBlur
     
      l.
         rgb2hsl split c
         +. $frameLum c. 0,1
         +.. $frameSat c.. 0,1
         +... $frameHue %... 360
         a c hsl2rgb
      done
     
      100%,100%,1,1,0
      fx_frame_round. $frameSize,20,1,255,255,255,255,0,0,3
      remove_opacity.
      n. 0,255
     
      [-1]
     
      if $frameType>=1 # inset, groove, ridge
         negate.
      fi
     
      if $frameType>=2 # groove, ridge
         gradient_norm.
      fi
     
      if $frameType==3 # ridge
         negate.
      fi
     
      fx_smooth_antialias. 100,10,5,0,50,50
     
      negate.
     


      l.
         # inspired by emboss_image of Reptorian
         b. $reliefWidth
         fill. if(abs(i)<1e-10,0,i) # to work around https://github.com/dtschump/gmic/issues/402
         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.
     
      apply_curve. 1,0,{127-$reliefAmount},255,{128+$reliefAmount}
     
      fill[0] i#2*i#1+(255-i#2)*i n[0] 0,255
      rm.. rm..
     
      blend grainmerge,1
      fx_noise. $grainAmount,$grainType,16,1,0,50,50

   }

Author:  Reptorian [ Fri Jul 29, 2022 8:02 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

@cli346

I think you're learning fast, and you did something I never thought of after all these years

The way you use $*, and using variables that way, I haven't thought of that for GUI filters.

Author:  cli345 [ Sat Jul 30, 2022 12:30 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hello, :)

@Reptorian
You have also made a lot of code that I don't understand yet.
Thanks to you, I have been able to include the groove effect into the "Comicbook" filter and into the "Lineart" filter.
This filter ("Frame [Relief]") doesn't stand without the algorithm of your "emboss_image" function.

Thank you very much Reptorian! :tyspin

@PixLab
Thank you for all the details. Is the bug fixed now in your configuration?

Author:  MareroQ [ Sat Jul 30, 2022 9:17 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hi Claude.
Adjusting the 'Frame Hue Change' changes not only the frame but also the image.
The intended effect?

Attachments:
FrameRelief.jpg
FrameRelief.jpg [ 108.82 KiB | Viewed 1994 times ]

Author:  sallyanne [ Sun Jul 31, 2022 12:13 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

@MareroQ
Probably something you have already checked but by your screen shot I would think the 'output mode' should be for new layer/s

Author:  Rod [ Sun Jul 31, 2022 2:56 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

MareroQ wrote:
Hi Claude.
Thanks for the new filter. :bigthup
My favorite is the Groove type.

My fav as well! Thank you Claude! :paint

Attachment:
GMIC-Frames_RD-2022-07-31_034938.jpg
GMIC-Frames_RD-2022-07-31_034938.jpg [ 117.14 KiB | Viewed 1974 times ]

Author:  PixLab [ Sun Jul 31, 2022 3:26 am ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

MareroQ wrote:
Hi Claude.
Adjusting the 'Frame Hue Change' changes not only the frame but also the image.
The intended effect?


Me as well, and image is becoming fully gray
Hi Claude,
I would add, adding noise, add noise to the whole image (I would expect on the frame only)
Other than that, excellent fix, it works well now :clap

Attachment:
ksnip_20220731-135722.jpg
ksnip_20220731-135722.jpg [ 445.23 KiB | Viewed 1972 times ]

Author:  cli345 [ Sun Aug 07, 2022 12:19 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

MareroQ wrote:
Adjusting the 'Frame Hue Change' changes not only the frame but also the image.
The intended effect?
Hi MareroQ! :)

:oops: Oops, it's a bug. I've forgotten to test an image with alpha channel. Here is the fixed code:
#@gui ____<b>Frames</b>
#------------------
#@gui Frame [Relief] (prerelease): cl_reliefFrame_prerelease, cl_reliefFrame_prerelease(1)
#@gui : note = note("<b>Frame Limit:</b>")
#@gui : Type = choice(1, "Outset", "Inset", "Groove", "Ridge")
#@gui : Size = float(10,6,20)
#@gui : Relief Width = float(1.5,0,10)
#@gui : Relief Amount = float(75,0,127)
#@gui : sep = separator()
#@gui : note = note("<b>Frame Area:</b>")
#@gui : Kaleidoscope Effect = bool(1)
#@gui : Frame Blur = float(60,5,80)
#@gui : Frame Hue Change = float(0,-180,180)
#@gui : Frame Saturation Change = float(0,-1,1)
#@gui : Frame Luminosity Change = float(0,-0.5,0.5)
#@gui : sep = separator()
#@gui : note = note("<b>Graininess:</b>")
#@gui : Graininess Type = choice("Gaussian", "Uniform", "Poisson")
#@gui : Graininess Amount = float(0,0,80)
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>.      Latest Update: <i>2022/08/01</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé and an algorithm of Reptorian.</small>")

cl_reliefFrame_prerelease:
   
   frameType,frameSize,reliefWidth,reliefAmount,kaleido,frameBlur,frameHue,frameSat,frameLum,grainType,grainAmount=$*
   
   if $grainType==2
      grainType=3
   fi
   
   foreach {
      remove_opacity.
     
      [-1]
      if $kaleido
         fx_kaleidoscope. 50,50,0,0,100,10,2
      fi
      b. $frameBlur
     
      l.
         rgb2hsl split c
         +. $frameLum c. 0,1
         +.. $frameSat c.. 0,1
         +... $frameHue %... 360
         a c hsl2rgb
      done
     
      100%,100%,1,1,0
      fx_frame_round. $frameSize,20,1,255,255,255,255,0,0,3
      remove_opacity.
      n. 0,255
     
      [-1]
     
      if $frameType>=1 # inset, groove, ridge
         negate.
      fi
     
      if $frameType>=2 # groove, ridge
         gradient_norm.
      fi
     
      if $frameType==3 # ridge
         negate.
      fi
     
      fx_smooth_antialias. 100,10,5,0,50,50
     
      negate.
     
    
    
      l.
         # inspired by emboss_image of Reptorian
         b. $reliefWidth
         fill. if(abs(i)<1e-10,0,i) # to work around https://github.com/dtschump/gmic/issues/402
         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.
     
      apply_curve. 1,0,{127-$reliefAmount},255,{128+$reliefAmount}
     
      fill[0] i#2*i#1+(255-i#2)*i n[0] 0,255
      rm.. rm..
     
      blend grainmerge,1
      fx_noise. $grainAmount,$grainType,16,1,0,50,50

   }



PixLab wrote:
I would add, adding noise, add noise to the whole image (I would expect on the frame only)

Hi PixLab! :)

I haven't thought putting noise on the frame only (I wanted to emulate a kind of metal box). I think I'll give the two possibilities.

Thank you all for your valuable feedback! :tyspin :)

Author:  Reptorian [ Sun Aug 07, 2022 5:57 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hi cli345,

I would like to remind you that gmic-community github has been moved: https://discuss.pixls.us/t/change-locat ... ub/32016/4

Author:  PixLab [ Sun Aug 07, 2022 10:05 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

cli345 wrote:
Hi MareroQ! :)
:oops: Oops, it's a bug. I've forgotten to test an image with alpha channel. Here is the fixed code:
-----------
Hi PixLab! :)
I haven't thought putting noise on the frame only (I wanted to emulate a kind of metal box). I think I'll give the two possibilities.

Thank you all for your valuable feedback! :tyspin :)


Nice fix cli345, now hue/saturation/luminosity work like a charm :clap
:tyspin

Author:  cli345 [ Fri Aug 19, 2022 12:25 pm ]
Post subject:  Re: New G'MIC filter "Frame [Relief]"

Hello! :)

Here is just a little improvement:
  • Default type is now "Groove".
  • An additional parameter ("Graininess on") enables to choose where the graininess is put.
Here is the code:
#@gui ____<b>Frames</b>
#------------------
#@gui Frame [Relief] (prerelease): cl_reliefFrame_prerelease, cl_reliefFrame_prerelease(1)
#@gui : note = note("<b>Frame Limit:</b>")
#@gui : Type = choice(2, "Outset", "Inset", "Groove", "Ridge")
#@gui : Size = float(10,6,20)
#@gui : Relief Width = float(1.5,0,10)
#@gui : Relief Amount = float(75,0,127)
#@gui : sep = separator()
#@gui : note = note("<b>Frame Area:</b>")
#@gui : Kaleidoscope Effect = bool(1)
#@gui : Frame Blur = float(60,5,80)
#@gui : Frame Hue Change = float(0,-180,180)
#@gui : Frame Saturation Change = float(0,-1,1)
#@gui : Frame Luminosity Change = float(0,-0.5,0.5)
#@gui : sep = separator()
#@gui : note = note("<b>Graininess:</b>")
#@gui : Graininess Type = choice("Gaussian", "Uniform", "Poisson")
#@gui : Graininess Amount = float(0,0,80)
#@gui : Graininess on = choice("Frame", "Picture", "Both")
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>.      Latest Update: <i>2022/08/18</i>.</small>")
#@gui : note = note("<small>It uses filters of David Tschumperlé and an algorithm of Reptorian.</small>")

cl_reliefFrame_prerelease:
   
   frameType,frameSize,reliefWidth,reliefAmount,kaleido,frameBlur,frameHue,frameSat,frameLum,grainType,grainAmount,grainFrameOn=$*
   
   if $grainType==2
      grainType=3
   fi
   
   foreach {
      remove_opacity.
     
      [-1]
      if $kaleido
         fx_kaleidoscope. 50,50,0,0,100,10,2
      fi
      b. $frameBlur
     
      l.
         rgb2hsl split c
         +. $frameLum c. 0,1
         +.. $frameSat c.. 0,1
         +... $frameHue %... 360
         a c hsl2rgb
      done
     
      if $grainFrameOn==0
         fx_noise. $grainAmount,$grainType,16,1,0,50,50
      elif $grainFrameOn==1
         fx_noise.. $grainAmount,$grainType,16,1,0,50,50
      fi
     
      100%,100%,1,1,0
      fx_frame_round. $frameSize,20,1,255,255,255,255,0,0,3
      remove_opacity.
      n. 0,255
     
      [-1]
     
      if $frameType>=1 # inset, groove, ridge
         negate.
      fi
     
      if $frameType>=2 # groove, ridge
         gradient_norm.
      fi
     
      if $frameType==3 # ridge
         negate.
      fi
     
      fx_smooth_antialias. 100,10,5,0,50,50
     
      negate.
     
    
    
      l.
         # inspired by emboss_image of Reptorian
         b. $reliefWidth
         fill. if(abs(i)<1e-10,0,i) # to work around https://github.com/dtschump/gmic/issues/402
         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.
     
      apply_curve. 1,0,{127-$reliefAmount},255,{128+$reliefAmount}
     
      fill[0] i#2*i#1+(255-i#2)*i n[0] 0,255
      rm.. rm..
     
      blend grainmerge,1
      if $grainFrameOn==2
         fx_noise. $grainAmount,$grainType,16,1,0,50,50
      fi
   }


Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/