The attached program converts 24  bit BMP's to QL mode 4/8 and QPC mode 32. The
BMP file must be 512x256 for a standard QL.

Malcolm



P Witte wrote:
000201c0da5f$db1b4680$a62b40c3@gamma">
Malcolm Lear writes:

Sorry I think I misunderstood you. I assumed you wanted a program to
convert bitmaps to
QPC hicolour. It would be quite a feat to convert down from 24 bit
to 3.

Not at all. That was just the ticket! However it doesnt quite work for
me. Looks like the picture is just out of sync.. Must have a closer
look. Anyway, thanks!


Per




100 REMark This program requires 24 bit BMP files and must be 512x256 for both QL modes
110 INPUT 'Filename ',file_name$
120 INPUT 'Mode 4,8 or 32? ',mde
130 l=LEN(file_name$)
140 IF l>4
150   IF file_name$(l-3 TO)=='.bmp' OR file_name$(l-3 TO)=='_bmp' THEN 
file_name$=file_name$(1 TO l-4)
160 END IF
170 OPEN#3,file_name$&'.bmp'
180 DELETE file_name$&'.scr'
190 OPEN_NEW#4,file_name$&'.scr'
200 BGET#3\18,wl,wm,n1,n2,hl,hm
210 w=wm*256+wl:h=hm*256+hl
220 BGET#3\28,bits
230 IF bits<>24 THEN PRINT 'Not 24 Bit Image':STOP
240 pos=FLEN(#3)-w*3
250 n=7:r=0:g=0:b=0
260 REPeat loop
270   BGET#3\pos:REMark set start of line
280   FOR p=1 TO w
290     BGET#3,blue,green,red
300     SELect ON mde
310     =0,4:
320       rn=RND(255)
330       bit=2^n
340       REMark check for yellow and use red/green
350       IF NOT red<rn AND NOT green<rn AND blue<rn
360         IF RND(1) THEN r=r||bit:ELSE g=g||bit
370       ELSE
380         REMark check for blue and substitute white
390         IF red<rn AND green<rn AND NOT blue<rn
400           r=r||bit:g=g||bit
410         ELSE
420           IF NOT red<rn   THEN r=r||bit
430           IF NOT green<rn THEN g=g||bit
440         END IF
450       END IF
460       n=n-1
470       IF n<0 THEN n=7:BPUT#4,g,r:g=0:r=0
480     =8:
490       rn=RND(255)
500       bit=2^n
510       IF n&&1
520         IF NOT red<rn   THEN r=r||bit
530         IF NOT green<rn THEN g=g||bit
540       ELSE
550         IF NOT blue<rn  THEN r=r||bit
560       END IF
570       n=n-1
580       IF n<0 THEN n=7:BPUT#4,g,r:g=0:r=0
590     =32:
600       red=red&&248:lgreen=green&&24:ugreen=green&&224:blue=blue&&248
610       BPUT#4,lgreen*8+blue/8,ugreen/32+red
620     =33:
630       PRINT 'Not Implemented'
640     END SELect
650   END FOR p
660   pos=pos-w*3:IF pos<54 THEN EXIT loop
670 END REPeat loop
680 CLOSE#3:CLOSE#4


Reply via email to