G'MIC fun with afre

gmic
fun

#5

I refined the purpose of the thread a bit more.


#6

I have yet to try it. Which settings do you typically use?


#7

The default setting usually work well with large images. It can take some time to process however. Here’s an image of my bike, I used 2 iterations setting on this one.


#8

More fun: this time a “blueprint” effect.

blueprint


[Play Raw] You can run but you can't hide
#9

I discovered that the effect in post #3 has an interesting application. It helped highlight spots that needed healing when I did this PlayRaw entry.


#10

Here is another fun effect. Its temp name is “ludic”: not quite lucid. :slight_smile: (I used something similar for my second alt on [PlayRaw] Landsat 8 image of Lake Elton

ludic_flower


New PhotoFlow batch processing options for setting image export parameters
(dumb) #11

Reminds me of GIMP’s alien map filter. Do you have the script code?


#12

Sure; it is not in #@gui format yet. It is different from the alien map filter. Since it piqued your interest, I might consider adding it as a filter. I have to figure out GitHub and GitLab someday… :stuck_out_tongue:

afre_ludic: skip ${1=14.5},${2=0},${3=0}
  if {$1<1||$1>15}
    e[] "\n  NB: Argument '$"1"' is not between 1 and 15.\n" v - q fi
  repeat $! l[$>]
    if !$2 b 1,1,1 fi
    n 0,{2^16-1} & {2^$1-1}
    if $2 b 1,1,1 fi
    n 0,255
    if $3 negate n 0,255 fi
  endl done

(dumb) #13

I see a main parameter, a skip parameter and a negation parameter. I’ll see what I can do.


#14

I have a bunch of techniques in my head but I usually forget about them. This is one of them.

1. skip is for cli and is a list of the default parameters.
2. The key line is n 0,{2^16-1} & {2^$1-1}. This filter is basically an application of bit planing.


(dumb) #15

Bit-planing is something I’ve been wanting to achieve for a while, as it happens. I gave up on it but this’ll help a lot.


#16

Glad I could help. I like simple concepts and implementations. One thing to note is that the default parameter is set to 14.5, which does not represent a bit plane per se. You would need positive integers; i.e., 1,2,3,... up to the max plane.


(dumb) #17

I’ve quickly made a bit plane decomposer for 8-bit RGB images:

to_rgb
repeat 8
[0]
l[-1] & {2^$>} endl
done
rm[0]
#n 0,255

Making a reverse command shouldn’t be difficult (without that extra commented n it’s just a case of blend add but it might require some kind of idiotproofing to cram values into a plane before recomposition.


#18

The reverse command is +. :slight_smile:


(dumb) #19

Thanks for the help, here’s what I have now:

##decompose
to_rgb
repeat 8
[0]
&[-1] {2^$>}
done
rm[0]
#n 0,255

##recompose
#repeat 8
#n[{$>}] 0,{2^$>}
#done
+

(G'MIC staff) #20
binary_planes :
  sp lena

  # Decompose (as a 8-slices volume).
  100%,100%,8,100%,"(i(#-1,x,y,0,c)>>z)&1"

  # Recompose.
  100%,100%,1,100%,"a=0;for(k=0,k<8,++k,a+=i(#-1,x,y,k)*2^k)"

(dumb) #21

Edit: it turned out that my earlier implementation was faster on my machine, not sure why. I’m using 2.4.1. Here’s what I’ve built around that:

#@gui 8-Bit planes : fx_bitplane8, fx_bitplane8_preview(1)
#@gui : Mode = choice("Decompose","Recompose")
#@gui : Split mode = choice("Z layers","Separate images")
#@gui : Scale mode = choice("True","1","255")
fx_bitplane8 :
if $1
##recompose
if {!$2} s z fi
repeat {int($!/8)} l[$>-{$>+7}]
repeat 8
iter=$>
l[$>]
if {$3==0}
/ {2^$iter} cut 0,1 round 0,1 * {2^$iter}
elif {$3==1}
cut 0,1 round 0,1 * {2^$iter}
elif {$3==2}
/ 255 cut 0,1 round 0,1 * {2^$iter}
fi
endl done
+
endl done
else
##decompose
repeat 8
[0]
&[-1] {2^$>} 
if {$3==1}
/[-1] {2^$>}
elif {$3==2}
/[-1] {2^$>/255}
fi
if {!$2} a[^0] z fi
done
rm[0]
fi
#n 0,255
fx_bitplane8_preview :
fx_bitplane8 $*

#22

Whatever works for you. As I said before, I prefer simple and elegant, short and sweet. :stuck_out_tongue:


(dumb) #23

I admit that it’s a bit of a mess but it seems to work exactly as I feel it should:

  • An option to keep true values, set values to either 0 or 1 or set them to either 0 or 255

  • Repeats on every 8 slices, doesn’t do anything else

  • Rounds values for idiotproofing (but being G’MIC code, it’s easily-hackable).

  • Options to keep 8 separate images or merge them along the Z axis

Given that in hindsight some of my commands have very questionable design choices (like that extra ‘recompute’ option which the commands require as arguments despite it only having a use to easily refresh any randomising things through the GUI without resetting parameters), I suppose I’ll need to redesign some of the commands I’ve made.


#24

I was having some G’MIC fun yesterday and came up with something interesting. See post #307 of G’MIC exercises for more info. As usual, it is just something that I stumbled upon and so might not be compelling to you. :blush:

texture_afre