Reptillian

Reptorian's G'MIC Code Workshop

Recommended Posts

$1 is not defined in the way that C# does it. If you place $1, it becomes it own variable. $1 would be distortion_main in cli, and Distortion Factor for the GUI. If I set $1 to 0, it goes from log(10^-8)*$1 = -18.40*0 = 0. If someone wants to define a variable for $name, this is how one would do it for g'mic.

test={5*10}

$test

Then, $test becomes 50. Does this explain thing? I know there's sometimes a language barrier between programmers with two very different programming languages.

 

----

EDIT: @Ego Eram Reputo I found the problem. It has to do with angle, which confuses me, but now I know where it lies.

 

Edited by Reptillian

Share this post


Link to post
Share on other sites

Got news, it seem like my health is on decline as it has been for years due to a nose problem. At this point, I can’t effectively can’t work on filters until I get resolved. I will be available, regardless. So, I’ll have to hold back on this for a good while. Maybe a half a month.

Share this post


Link to post
Share on other sites

It didn't seem like the nose was the problem in the end though I still have a surgery appointment for that. Maybe, I had a cold and that ended up in me suffering for 1 week with 1 hour of sleep (gotten past that). So, I am writing filters again.

 

Maybe I shouldn't really be doing this and take more rest. But, I'll probably do anyway.

if 1 to_gray fi #One Channel#
3,3,1,1
f. "
ang=pi*(50/180);
ix=x-1;
iy=y-1;
IX=ix*cos(ang)-iy*sin(ang);
IY=ix*sin(ang)+iy*cos(ang);
ix=IX;
iy=IY;
sur=(atan2(abs(ix),iy)-pi/2)/(pi/2);
!((x==1)&&(y==1))?sur*2:0;
"
convolve.. .,1,1 k.. blur 5 n -1,1
if 1 + 1 * 127.5 fi #if 8bit, then 0#

Paste this to code filter to see what I'm working on. It's a better version of emboss filter of my own as it applies to multiple channels at once. I'll probably have to add something in the end for legacy support or something.

Share this post


Link to post
Share on other sites

Nah, I don't think I"ll be interested into doing emboss. I'm having legit trouble trying to create the bias factor, and normalizing it. So, That's on hold. As a matter of fact, I do have a workaround to that.

 

Now, I think I actually got something here, but it's different. Paste it within code[global] or code[local] to see how this works.

repeat $! l[$>]
Sublevel=1
Angle_Stitch=75
Thickness=1
Interpolation=3
Intensity=100
Boundary=1
iw={w}
ih={h}
ang={pi*($Angle_Stitch/180)}
ang2={pi*(($Angle_Stitch+90)/180)}
r {($Sublevel+1)*100}%,{($Sublevel+1)*100}%,100%,100%,1
{w},{h},1,1,sur=x*cos($ang)+y*sin($ang);floor(sur/($Thickness*($Sublevel+1)))
{max(1,round(iM,1,1))},1,1,1,u(1) round. map.. . rm. -. {iM/2} f. i<0?-1:1
repeat s#0 sh[0] $>
f. "sx="$Intensity"*cos("$ang2")*i#1;sy="$Intensity"*sin("$ang2")*i#1;sx+=x;sy+=y;i(sx,sy,z,c,"$Interpolation","$Boundary")" rm. done rm.
r {$iw},{$ih},100%,100%,{$Interpolation}
endl
done

Based off the principle of @pyrochild Stitch plugin. I will be adding more options, and enabling multiple angles(not just two).

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

New updates will come soon. Just bug fixes, and removal. These changes will come by next week as it's Saturday. Right now, this update isn't here yet, but letting y'all know.

  1. Spiral Matrix Transform has been removed. It is obsoleted by Joan Rake's Spiral Matrix Transform. That also works on images bigger than 4096x4096. So, no reason to keep this anymore.
  2. Logarithmic Distortion has been fixed. There should be no crash.
  3. Nebulous has further fixes, and a slight upgrade.

 

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

I want to make sure of this. Is it worth improving Vibrato and OOBS? I don't feel like they're used all that much. I know exactly how I can improve Vibrato, but it seem fine for one color image as you can get abstract there. I'm about to extend Modulo Texture further.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Decided to extend my existing Color Modulo Texture after reading more of @MadJik thread. I was basing my older version off the one that I had. Now, here's the cli options.

#@cli rep_color_modulo_texture: 0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
_diagonal_flip= { 0=not flipped | 1 = flipped },_subpixel_processing_level>0,0<=_interpolation<=5,0<=_colorspacemode<=12,_contain_alpha= { 0=no_alpha | 1=alpha },\
0<=_channel_num<=4,0<=_channel_num<=4,0<=_channel_num<=4,0<=_channel_num<=4

And a image to go with the upgrade of my own Color Modulo Texture.

 

image.png.b62ccb3304fe6e4a8c6c9c554bac8246.png

 

That's CMYK color modulo texture with everything centered and no angle change using continuous divisive modulo mode. Beautiful, huh?

 

For those who wants the code early before G'MIC can actually update again :

 

@cli rep_colmt: (eq. to rep_color_modulo_texture)
rep_colmt: rep_color_modulo_texture $*
#@cli rep_color_modulo_texture: 0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
0<=_modulo_method<=5,_maxmod>0,_endmodvalue>0,0<=_angle<=360,_value_shift>0,_centered= { 0=Not centered | 1=Centered },_negate_mod= { 0=normal | 1=inverted },_normalize_bool= { 0=Do not Normalize | 1=Normalize },\
_diagonal_flip= { 0=not flipped | 1 = flipped },_subpixel_processing_level>0,0<=_interpolation<=5,0<=_colorspacemode<=12,_contain_alpha= { 0=no_alpha | 1=alpha },\
0<=_channel_num<=4,0<=_channel_num<=4,0<=_channel_num<=4,0<=_channel_num<=4
#@cli: Inspired by MadJik's Color Modulo Texture for Paint.NET, this is a extension of that filter converted into G'MIC form. New features is being able to change color space, allow alpha, anti-aliasing...
rep_color_modulo_texture:
repeat $! l[$>]
lcmod_1=$38
lcmod_2=$39
lcmod_3=$40
lcmod_4=$41
cs=$36
alp=$37
diag=$33
interpolation=$35
subpixel=$34
subpixel+=1
tc={$cs!=3?3+$alp:4}
iw={w}
ih={h}
maxv={max(w,h)}
sd={min(w,h)/max(w,h)}
sx={w<h?$sd:1}
sy={h<w?$sd:1}
msx={.5*$sx}
msy={.5*$sy}
center=1
f 0 r {$interpolation?$subpixel*100:100}%,{$interpolation?$subpixel*100:100}%,100%,$tc
($lcmod_1,$lcmod_2,$lcmod_3,$lcmod_4)
l. 
    s x ti=$! remove_duplicates 
    if $!!=$ti v + error "Invalid channel inputs!" v - fi a x 
endl
repeat $tc sh[0] {i(#1,$>,0)} done rm[1]
f[1] ang=pi*($4/180);ix=(x/w)-.5;iy=(y/h)-.5;ix*=$sx;iy*=$sy;IX=ix*cos(ang)-iy*sin(ang);IX+=!$6?$msx;IX*=$maxv;ix=IX;ix/$subpixel abs[1] modf[1] $1,$2,{$3/$2} 
    if {$8&&($1<2)} +[1] {$3<$2?$3} fi 
    if $7 negate[1] fi 
    temp={im#1} -[1] $temp modf[1] 4,{iM#1},$5 +[1] $temp
f[2] ang=pi*($12/180);ix=(x/w)-.5;iy=(y/h)-.5;ix*=$sx;iy*=$sy;IY=ix*sin(ang)+iy*cos(ang);IY+=!$14?$msx;IY*=$maxv;iy=IY;iy/$subpixel abs[2] modf[2] $9,$10,{$11/$10} 
    if {$16&&($9<2)} +[2] {$11<$10?$11} fi 
    if $15 negate[2] fi 
    temp={im#2} -[2] $temp modf[2] 4,{iM#2},$13 +[2] $temp 
f[3] ang=pi*($20/180);ix=(x/w)-.5;iy=(y/h)-.5;ix*=$sx;iy*=$sy;IX=ix*cos(ang)-iy*sin(ang);IY=ix*sin(ang)+iy*cos(ang);IX+=!$22?$msx;IX*=$maxv;IY+=!$22?$msx;IY*=$maxv;ix=IX;iy=IY;($diag?(abs(ix)+abs(iy)):abs(abs(ix)-abs(iy)))/$subpixel modf[3] $17,$18,{$19/$18} 
    if {$24&&($17<2)} +[3] {$19<$18?$19} fi 
    if $23 negate[3] fi 
    temp={im#3} -[3] $temp modf[3] 4,{iM#3},$21 +[3] $temp 
if $tc==4 
    f[4] ang=pi*($28/180);ix=(x/w)-.5;iy=(y/h)-.5;ix*=$sx;iy*=$sy;IX=ix*cos(ang)-iy*sin(ang);IY=ix*sin(ang)+iy*cos(ang);IX+=!$30?$msx;IX*=$maxv;IY+=!$30?$msx;IY*=$maxv;ix=IX;iy=IY;(!$diag?(abs(ix)+abs(iy)):abs(abs(ix)-abs(iy)))/$subpixel modf[4] $25,$26,{$27/$26} 
    if {$32&&($25<2)} +[4] {$27<$26?$27} fi  
    if $31 negate[4] fi 
    temp={im#4} -[4] $temp modf[4] 4,{iM#4},$29 +[4] 
fi
k[0]
if $interpolation&&($subpixel>=2) r $iw,$ih,100%,100%,$interpolation fi
if $cs!=3
    if $cs!=0 sh 0,2 fi
    if $cs==1 ryb2rgb.
    elif $cs==2 cmy2rgb.
    elif $cs==4 hsi82rgb.
    elif $cs==5 hsl82rgb.
    elif $cs==6 hsv82rgb.
    elif $cs==7 lab82rgb.
    elif $cs==8 lch82rgb.
    elif $cs==9 yiq8rgb.
    elif $cs==10 yuv82rgb.
    elif $cs==11 yuv82rgb.
    elif $cs==12 xyz82rgb.
    fi
    if $cs!=0 rm. fi
else
    cmyk2rgb
fi
endl done

For some reason, rep_colmt didn't work. Paste this to userxxxx.gmic, then go into code[local] and paste this to get the result like I had - rep_color_modulo_texture 3,255,64,0,0,1,0,0,3,255,64,0,0,1,0,0,3,255,64,0,0,1,0,0,3,255,64,0,0,1,0,0,1,1,3,3,1,0,1,2,3

Edited by Reptillian

Share this post


Link to post
Share on other sites

Even though 2.7.0 is not available for Paint.NET and you won't see this update, during the meantime, I"ll post changes that'll be coming.

 

New Changes: 50 new palettes, fixes to distortion filters - For details - Fixes to distortion filters, and 50 new palettes #196

 

EDIT: Next up, I"ll probably make a way to export those palettes. But, it's more likely I"ll work on modulo and continue into developing the concrete texture.

Edited by Reptillian

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.