Reptorian G'MIC Filters

Guess what I managed to create in G’MIC without the use of BIGINT library?

Still, some bugs though. I’m not sure how to properly convert a image representing a large number into a image of binary yet it seems. Ooh, so close. I wish dec2bin and bin2dec would allow for humongous digits for this case or something like that.

$ 106,17 rep_tupper
#@cli rep_tupper: k
#@cli : Generates output of K onto images.
rep_tupper:
skip ${1=960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143786841806593422227898388722980000748404719}
check "$#==1"
fill "y+x*h" mirror. x

decimal_number=$1

1 # 1. Insert Binary Here

1 # 2. Create single pixel image for use dynamic processing.

eval "
 number='$1';
 const divisor=h#0;
 const n_size=size(number);
 const n_0=_'0';
 index=0;
 dividend=number[index]-n_0;
 
 while(dividend<divisor,
  dividend=dividend*10+(number[++index]-n_0);
 );
 
 while(n_size>index,
  da_push(#-1,int(dividend/divisor)+n_0);
  dividend=(dividend%divisor)*10+(number[++index]-n_0);
 );
 
 da_push(#-2,(i[#-1,da_size(#-1)-1]-n_0)&1);
 ds=da_size(#-1);
 ds?da_freeze(#-1);
 "

decimal_number={t}

repeat inf {
 rm. 1 
 
 eval "
  number='"$decimal_number"';
  const divisor=2;
  const n_size=size(number);
  const n_0=_'0';
  index=0;
  dividend=number[index]-n_0;
 
  while(dividend<divisor,
   dividend=dividend*10+(number[++index]-n_0);
  );
 
  while(n_size>index,
   da_push(#-1,int(dividend/divisor)+n_0);
   dividend=(dividend%divisor)*10+(number[++index]-n_0);
  );

  da_push(#-2,(i[#-1,da_size(#-1)-1]-n_0)&1);
  ds=da_size(#-1);
  ds?da_freeze(#-1);
  "
  
  decimal_number={t}
  
  if h#-1==1 break fi 
}

rm. eval da_freeze(#-1)

map.. . rm.

EDIT: I fixed the bug. :slight_smile:

It looks like this fun filter is happening though I can’t imagine a real use case of this other than teaching students how loading and exporting file work.