10 REM Image.bbc 1.02 04-Jun-2005
   20 REM Access various information from image files
   30 REM v1.02 Only does JPEGs at the moment
   40 :
   50 DEFPROCimg_Info(A$):LOCAL header%,length%
   60 img_width%=-1:img_height%=-1:img_depth%=-1:img_size%=-1:img_type$=""
   70 in%=OPENIN(A$):IFin%=0:ENDPROC
   80 img_size%=EXT#in%:img_type$=RIGHT$(A$,4)
   90 CASE FNlc(img_type$) OF
  100   WHEN ".jpg",".jpeg":
  110   A%=BGET#in%+BGET#in%
  120   REPEAT
  130     header%=256*BGET#in%+BGET#in%
  140     length%=256*BGET#in%+BGET#in%
  150     IF header%<>&FFC0 THEN PTR#in%=PTR#in%+length%-2
  160   UNTILheader%=&FFC0 OR EOF#in%
  170   IFNOTEOF#in% THEN
  180     A%=BGET#in%
  190     img_depth%=24
  200     img_height%=256*BGET#in%+BGET#in%
  210     img_width% =256*BGET#in%+BGET#in%
  220   ENDIF
  230   img_type$="JPEG"
  240   WHEN ".bmp":
  250   img_type$=""
  260 OTHERWISE
  270   img_type$=""
  280 ENDCASE
  290 CLOSE#in%:in%=0
  300 ENDPROC
  310 :