Hi, I am having a problem with this command I’m working on. See the bottom image to see what I mean. The black image contains value of 1,0 only. That’s why it is a black image.
# $ gmic i lena1.png i 5050.png channels. 0 rep_form_pixel_generate_results_a 0,0,50,50#
rep_form_pixel_generate_results_a:
{w#0},{h#0},1,{s#0},i0#1*i#0
{w#0},{h#0},1,{s#0},(1-i0#1)*i#0
repeat s#0
ci={$>}
repeat 2 sh.. $ci done
sh[0] $ci
f. "
begin(
const ww=abs($3);
const hh=abs($4);
const wwhh=ww*hh;
const length=floor(w/ww);
avg_a=vectorlength(0);
avg_b=vectorlength(0);
avg_c=avg(crop(#1,0,0,ww,hh));
w_avg=wwhh*avg_c;
iw_avg=wwhh-w_avg;
);
if(!x&&!(y%hh),
for(v=0,v<length,v++,
avg_a[v]=sum(crop(#-3,v*ww,y,ww,hh))/w_avg;
avg_b[v]=sum(crop(#-2,v*ww,y,ww,hh))/iw_avg;
);
);
lerp(avg_a[floor(x/ww)],avg_b[floor(x/ww)],i#1);
"
rm[-3--1]
done
rm[-2,-1]