Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
#ESCAPECHARS ON
|
||||
|
||||
DIM bmpin = ".\\LenaClr.bmp", ppmout = ".\\Lena.ppm", bmpblob = 54 ' Size of BMP file headers
|
||||
FILEGET(FILEOPEN(bmpin, BINARY), FILELEN(bmpin)): FILECLOSE(FILEOPEN) ' Fill buffer
|
||||
|
||||
DIM ppmheader AS STRING * 256, breadth, height
|
||||
LET(breadth, height) = 128 ' Image width and height
|
||||
SPRINTF(ppmheader, "P6\n%d %d\n255\n", breadth, height) ' Create PPM file header
|
||||
|
||||
DIM ppmdata AS STRING * (STRLEN(ppmheader) + FILELEN - bmpblob)
|
||||
DIM head = @ppmdata + STRLEN, tail = @FILEGET + FILELEN - breadth * 3 - 2 ' Start of last scanline
|
||||
ppmdata = ppmheader ' Copy PPM file header
|
||||
|
||||
WHILE tail >= @FILEGET + bmpblob ' Flip upside down
|
||||
FOR DIM w = 0 TO (breadth - 1) * 3 STEP 3
|
||||
POKE(head + 0 + w, CHR(PEEK(tail + 2 + w, 1))) ' Swap R
|
||||
POKE(head + 1 + w, CHR(PEEK(tail + 1 + w, 1))) ' Keep G
|
||||
POKE(head + 2 + w, CHR(PEEK(tail + 0 + w, 1))) ' Swap B
|
||||
NEXT
|
||||
INCR(head, breadth * 3): DECR(tail, breadth * 3) ' Next scanline
|
||||
WEND
|
||||
|
||||
FILEPUT(FILEOPEN(ppmout, BINARY_NEW), ppmdata): FILECLOSE(FILEOPEN)
|
||||
Loading…
Add table
Add a link
Reference in a new issue