f% = OPENIN("c:\lena.ppm") IF f%=0 ERROR 100, "Failed to open input file" IF GET$#f% <> "P6" ERROR 101, "File is not in P6 format" REPEAT in$ = GET$#f% UNTIL LEFT$(in$,1) <> "#" size$ = in$ max$ = GET$#f% Width% = VAL(size$) space% = INSTR(size$, " ") Height% = VALMID$(size$, space%) VDU 23,22,Width%;Height%;8,16,16,128 FOR y% = Height%-1 TO 0 STEP -1 FOR x% = 0 TO Width%-1 r% = BGET#f% : g% = BGET#f% : b% = BGET#f% l% = INT(0.3*r% + 0.59*g% + 0.11*b% + 0.5) PROCsetpixel(x%,y%,l%,l%,l%) NEXT NEXT y% END DEF PROCsetpixel(x%,y%,r%,g%,b%) COLOUR 1,r%,g%,b% GCOL 1 LINE x%*2,y%*2,x%*2,y%*2 ENDPROC