Some time ago i coded this picture converter below on sdlBasic. Is there some way to recode this using Python-Gimp and use this as picture filter? afaik, the Python syntax can be somehow similar of the used on sdlBasic, and maybe i'd need to use get_pixel and set_pixel, but i have no idea about how to do this - if someone do, please recode this as Python-Gimp plugin for allowing me and all of us how to do similar picture filters in a similar way - thanks in advance

finp$="8x5_entry.png"

xed=0:yed=0:open finp$ for input as #1:for i=1 to 16:n=readbyte(1):next:for i=1 to 2:n=readbyte(1):next

xed=readbyte(1)*256:xed=xed+readbyte(1):for i=1 to 2:n=readbyte(1):next:yed=readbyte(1)*256:yed=yed+readbyte(1)

close #1

setdisplay(xed,yed,32,1):paper(8^8-1):ink(0):pen(0):cls:

loadimage(finp$,1):pasteicon(0,0,1)

dim clust[8,8] '-,o4b[2]

a$="00,06,08,14,02,12,04,10,08,14,00,06,04,10,02,12"

for y2=0 to 3:for x2=0 to 3:lc=(y2*4)+x2

clust[x2,y2]=val(mid$(a$,(lc*3)+1,2)):next:next

dim cor[16]

cor[0]=0x000000:cor[1]=0x0000FF:cor[2]=0xFF0000:cor[3]=0xFF00FF:cor[4]=0x00FF00:cor[5]=0x00FFFF:cor[6]=0xFFFF00:cor[7]=0xFFFFFF

for y=0 to yed-1:for x=0 to xed-1

ind=point(x,y)

b=ind mod 256:ind=int(ind/256):g=ind mod 256:ind=int(ind/256):r=ind mod 256

patgf=(((clust[x mod 4,y mod 4]+1)*255)/16)

rpat=0:if r>patgf then:rpat=1:end if

gpat=0:if g>patgf then:gpat=1:end if

bpat=0:if b>patgf then:bpat=1:end if

o4b=(bpat+(rpat*2)+(gpat*4)) mod 8

ink(cor[o4b]):dot(x,y):next:next

fout$=finp$+".bmp":grab (1,0,0,xed,yed):saveimage(fout$,1)

Forums:

- Log in to post comments

## Well, I'm not into python-fu, but...

`R=put(0,0),put(6,1),put(8,2),put(14,3), put(2,4),put(12,5),put(4,6),put(10,7), put(8,8),put(14,9),put(0,10),put(6,11), put(4,12),put(10,13),put(12,14),put(12,15), r>put(((1+get(x%4+4*(y%4)))*255)/16,16)?rmax:rmin G=g>get(16)?gmax:gmin B=b>get(16)?bmax:bmin A=a`

You could even add some more fun by making the filter depending upon controler values:`R=put(0,0),put(6,1),put(8,2),put(14,3), put(2,4),put(12,5),put(4,6),put(10,7), put(8,8),put(14,9),put(0,10),put(6,11), put(4,12),put(10,13),put(12,14),put(12,15), r>put(((1+get(x%val(0,1,4)+val(0,1,4)*(y%val(0,1,4))))*ctl(1))/16,16)?rmax:rmin`

Where control 0 will change the size of the dither matrix and conrol 1 would change the intensity.## thanks

## I've been searching for GIMP Python tutorials too.

## this were my main concern