Graphics Resolution Viewer. 
Author Message
 Graphics Resolution Viewer.

Here is a graphics resolution viewer I wrote one day while I was bored.  It
will list all of the BMP, GIF, LBM and PCX files in the current directory
along the the resolution and the number of colors.

Chad Alberts

------------------------------------------------------------------------------

DEFINT A-Z

PRINT

IF COMMAND$ = "/?" THEN
   PRINT "Usage:    showres [filespec]"
   PRINT
   END
END IF

IF COMMAND$ = "" THEN
   filespec$ = "*.*"
ELSE
   filespec$ = COMMAND$
END IF

curfile$ = DIR$(filespec$)

IF LEN(curfile$) = 0 THEN
   PRINT "No GIF files found in current directory."
   END
END IF

WHILE LEN(curfile$) > 0

  curtype$ = RIGHT$(curfile$, 3)

  SELECT CASE curtype$
  CASE "BMP"
     OPEN curfile$ FOR BINARY AS #1
     GET #1, 19, xres
     GET #1, 23, yres
     GET #1, 27, bits
     CLOSE #1
     colors = 2 ^ bits
     PRINT curfile$, "-"; xres; "x"; yres; "x"; colors
  CASE "LBM"
     DIM header AS STRING * 4
     DIM inword  AS STRING * 2
     DIM inbyte  AS STRING * 1
     OPEN curfile$ FOR BINARY AS #1
     FOR x& = 1 TO LOF(1)
        GET #1, x&, header
        IF header = "BMHD" THEN BMHD& = (x& + 8): EXIT FOR
     NEXT
     GET #1, (BMHD& + 0), inword
     xres = ASC(RIGHT$(inword, 1)) + (ASC(LEFT$(inword, 1)) * 256)
     GET #1, (BMHD& + 2), inword
     yres = ASC(RIGHT$(inword, 1)) + (ASC(LEFT$(inword, 1)) * 256)
     GET #1, (BMHD& + 8), inbyte
     colors = 2 ^ ASC(inbyte)
     CLOSE #1
     PRINT curfile$, "-"; xres; "x"; yres; "x"; colors
  CASE "GIF"
     DIM flags AS STRING * 1
     OPEN curfile$ FOR BINARY AS #1
     GET #1, 7, xres
     GET #1, 9, yres
     GET #1, 11, flags
     CLOSE #1
     colors = 2 ^ ((ASC(flags) AND 7) + 1)
     PRINT curfile$, "-"; xres; "x"; yres; "x"; colors
  CASE "PCX"
     DIM BitsPerPixel AS STRING * 1
     DIM ColorPlanes  AS STRING * 1
     OPEN curfile$ FOR BINARY AS #1
     GET #1, 4, BitsPerPixel
     GET #1, 5, xmin
     GET #1, 7, ymin
     GET #1, 9, xmax
     GET #1, 11, ymax
     GET #1, 66, ColorPlanes
     CLOSE #1
     xres = (xmax - xmin) + 1
     yres = (ymax - ymin) + 1
     colors = 2 ^ (ASC(BitsPerPixel) * ASC(ColorPlanes))
     PRINT curfile$, "-"; xres; "x"; yres; "x"; colors
  END SELECT

  curfile$ = DIR$

WEND

--
*****************************************************************************

*****************************************************************************



Tue, 10 Sep 1996 11:59:59 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help : Viewer Images on form - depends on Resolution settings

2. Getting the resolution of a viewer in asp!?

3. Graphics viewer....

4. graphics file viewer

5. GRAPHICS VIEWER VBX ???

6. Where's that graphics viewer?

7. New file formats added to Graphics Viewer

8. Graphics Viewers

9. Graphic viewer

10. Changing graphic resolution under vb4

11. Changing graphic resolution

12. Graphic resolution

 

 
Powered by phpBB® Forum Software