Microsoft KB Archive/66359

= Microsoft Knowledge Base =

PICEM Views .PCX, .PIC, .GIF Files and Saves in BSAVE Format
Last reviewed: September 25, 1997

Article ID: Q66359

3.00 4.00 4.00b 4.50 MS-DOS kbprg kbcode kbfile

SUMMARY
You can download the freeware program PICEMA.EXE, which allows you to convert .PIC, .PCX, and .GIF graphics image files into Basic's BSAVE/BLOAD format files, as well as into .PIC, .PCX, .GIF, and .IMG file formats. PICEMA.EXE is a useful tool for converting graphics between different file formats.

This information applies to QuickBasic versions 3.0, 4.0, 4.0b, and 4.5; to Microsoft Basic Compiler versions 6.0 and 6.0b; and to Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2.

MORE INFORMATION
You can find PICEMA.EXE, a self-extracting file, on these services:

  Microsoft's World Wide Web site on the Internet On the www.microsoft.com home page, click the Support icon Click Knowledge Base, and select the product Enter kbfile PICEMA.EXE, and click GO! Open the article, and click the button to download the file   Internet (anonymous FTP) ftp ftp.microsoft.com Change to the Softlib/Mslfiles folder Get PICEMA.EXE   The Microsoft Network On the Edit menu, click Go To, and then click Other Location Type &quot;mssupport&quot; (without the quotation marks) Double-click the MS Software Library icon Find the appropriate product area Locate and Download PICEMA.EXE   Microsoft Download Service (MSDL) Dial (425) 936-6735 to connect to MSDL Download PICEMA.EXE 

For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q119591 TITLE    : How to Obtain Microsoft Support Files from Online Services If PICEMA.EXE doesn't work properly on your card, you need to tell it what mode to use via the PICEM /V: switch. See the /V: modes listed in PICEM.DOC.

Method 1
Here is a simple example of using PICEM version 2.1:

  Create a .PCX, .PIC, .GIF, or .IMG image file. For example, make an image in Microsoft Windows PaintBrush version 3.0, which comes with Microsoft Windows 3.0. Save the image in .PCX format (by choosing Save As from the File Menu, then clicking the Options button, then clicking PCX). Name the file IMAGE.PCX.   Run the following command (see PICEM.DOC for other options): PICEM /V:L IMAGE.PCX /V:L corresponds to the VGA/MCGA screen mode for 320 by 200 pixels, and 256 colors visible at once, which is the same as SCREEN 13 in Basic.   Press W while viewing the picture on the screen. This brings up a menu with the option of saving to any the following five formats: .BAS Basic BSAVE SCREEN .PIC Pictor/GRASP, PC Paint .PCX PC/Publishers Paintbrush .GIF Graphics Interchange Format .IMG Ventura/GEM Paint </li> Use an arrow key to select the Basic BSAVE format, press the ENTER key, and then PICEM will save the graphics file with a name extension of .BAS (in this example, IMAGE.BAS).</li>  You can then use this graphics file (IMAGE.BAS) in a Basic program such as the following: SCREEN 13 DEF SEG = &HA000 BLOAD &quot;IMAGE.BAS&quot; </li></ol>

Method 2
Here is more complicated way to save a picture in BSAVE/BLOAD format (as an alternative in case PICEM does not create the correct BSAVE format):

<ol>  Create a .PCX, .PIC, .GIF, or .IMG image file. For example, make an image in Microsoft Windows PaintBrush version 3.0, which comes with Microsoft Windows 3.0. Save the image in PCX format (by choosing Save As from the File Menu, then clicking the Options button, then clicking PCX). Name the file IMAGE.PCX. </li>  Write a Basic program that does the following: a. Uses the SCREEN statement to invoke a graphics mode that matches the video mode specified by PICEM /V (for example,     SCREEN 13 matches PICEM /V:L, which in turn matches with a      Windows Paintbrush .PCX file created on a VGA monitor): SCREEN 13

b. SHELLs to PICEM, which is invoked to match the Basic SCREEN mode and to load a graphics file. For example:

SHELL &quot;PICEM /E /V:L IMAGE.PCX&quot;

(The /E option causes PICEM to leave the screen in graphics mode     and not clear the screen.)

c. BSAVEs the picture.

(For more information about BSAVE, see the application note titled     &quot;How to BSAVE and BLOAD EGA and VGA Screens in QuickBasic,&quot;      BQ0084, which can be obtained by calling Microsoft Technical Support      at (425) 454-2030.)

For example:

DEF SEG= &HA000 BSAVE &quot;IMAGE.BSA&quot;,0,64000

Then you can later BLOAD as follows:

DEF SEG= &HA000 BLOAD &quot;IMAGE.BSA&quot;,0 </li></ol>

If you don't match Basic's screen mode with the mode used by PICEM, method 2 above won't work because Basic will reset the screen mode after the SHELL if the mode doesn't match.

QuickBasic has a limited number of graphics modes. The best picture you can do is 640x480x16 (Basic's SCREEN 12; PICEM /V:M) or 320x200x256 (Basic's SCREEN 13; PICEM /V:L). Using method 2 above, you cannot BSAVE a 640x480x256 image or the more common standard mode 640x400x256. QuickBasic doesn't know these modes, and therefore, will reset the screen contents immediately after the SHELL.

You can try method 1 if you want to create a BSAVE format file from a graphics file that uses a non-Basic screen mode.

Code Example for Method 2
SCREEN 13 SHELL &quot;PICEM /E /V:L IMAGE.PCX

' Mode 13 is 320x200x(1 byte for 256 colors), thus save/load 64000 ' bytes. total! = 64000

DEF SEG = &HA000  'Define the segment for VGA graphics. 'How to BSAVE the file: f$ = &quot;IMAGE.BSA&quot; 'Save VGA memory in a file. BSAVE f$, 0, total! 'Save the visual page, at offset 0. 'How to BLOAD the file: BLOAD f$, 0           '0 is the offset to page 0.