-filetype

Top  Previous  Next

-filetype filetype

 

 

Alternate command:
-filetype filetype

 

 

The -filetype parameter determines the image file type that will be saved.  If -filetype is not specified, the file type will be a Windows BMP file.  If the -multipage option is used, the file will be a multipaged image file (only TIFF, PCX, PDF, and PostScript formats allow multi-page image files).

 

TwainSave can save files using one of two modes:

 

To a file format that is supported by all TWAIN devices (Mode 1).
To a file format that is supported by specific TWAIN devices (Mode 2).

 

Below will be a brief description of each mode:

 


Mode 1

 

For most users, the first mode, mode 1, is sufficient for most uses of TwainSave. In addition, all TWAIN devices are able to save files using these file types.  It doesn't matter if it is an inexpensive TWAIN digital camera, or a sophisticated TWAIN high-end scanner, the device will be able to save to a mode 1 file type.

 

The valid values for -filetype that save files in mode 1 are as follows:

 

bmp

Windows BMP file

emf

Enhanced Windows meta-file format

gif

Compuserve GIF format

ico

Windows ICON format

icov

Vista compatible ICONs

jpeg

JPEG format

jp2

JPEG-2000 format

pcx

PCX format

pdf

Adobe PDF format

png

Portable Network Graphics (PNG) format

psd

Adobe Photoshop format

ps1

PostScript Level 1 format

ps2

Postscript Level 2 format

tga

Targa Format

tif1

uncompressed TIFF image

tif2

TIFF using PackBits compression

tif3

TIFF using Group 3 Fax compression

tif4

TIFF using Group 4 Fax compression

tif5

TIFF using JPEG compression

tif6

TIFF using Flate compression

tif7

TIFF using LZW compression

wbmp

Wireless Bitmap

wmf

Windows Meta File.

                       

Example:  Acquire to a Group 3 TIFF format, the file is called mytif.tif:

twainsave -filetype tif3 -filename mytif.tif

 


Mode 2

 

This mode is for users that are using TWAIN devices that have an internal TWAIN file transfer mechanism.  Many TWAIN devices are able to create data files using file formats that mode 1 does not support, or possibly have enhanced versions of the file types that mode 1 supports.  Some of these file types are PDF/A, FPX, SPIFF, JBIG, and other file types.  To do this, the device's TWAIN driver must have built-in file support and support the file type requested.  Note that not all TWAIN devices has built-in file transfer support.

 

To summarize, mode 2 differs from mode 1 above in the following ways:
 

The TWAIN device must support the mode 2 file transfer requested, therefore some devices may not be able to use this mode.
mode 2 cannot perform blank page detection (-noblankpages) since all operations from file transfer to file creation is controlled by the device's TWAIN driver.  TwainSave cannot intercept or interrupt this operation to report on blank pages.

 

The table below shows the various settings for mode 2 file types, however these settings are only available for devices that support such file types.

 

bmp1_mode2

Windows BMP file.  No compression.

bmp2_mode2

Windows BMP file. RLE 4 compressed.

bmp3_mode2

Windows BMP file. RLE 8 compressed.

bmp4_mode2

Windows BMP file. Bitfields are used.

dejavu_mode2

Lizardtech DejaVu file.

exif_mode2

EXIF format.

fpx_mode2

FlashPix (FPX) format.

jfif_mode2

JPEG image format within JFIF wrapper.

jpeg_mode2

JPEG image format

jp2_mode2

JPEG-2000 format.

jpx_mode2

JPX format (JPEG ISO/IEC 15444-2 format)

pdf_mode2

Adobe PDF format

pdfa1_mode2

Adobe PDF/A version 1 format.

pdfa2_mode2

Adobe PDF/A version 2 format.

pict_mode2

Macintosh PICT format.

png_mode2

PNG format.

spiff1_mode2

SPIFF format using JPEG.

spiff2_mode2

SPIFF format using JBIG.

tif1_mode2

TIFF file.  No compression.

tif2_mode2

TIFF file.  Group 3, 1 dimensional fax format.

tif3_mode2

TIFF file.  Group 3, 1 dimensional EOL fax format.

tif4_mode2

TIFF file.  Group 3, 2 dimensional fax format.

tif5_mode2

TIFF file.  Group 4 fax format.

tif6_mode2

TIFF file.  JPEG compressed format.

tif7_mode2

TIFF file.  LZW compressed format.

tif8_mode2

TIFF file.  JBIG compressed format.

tif9_mode2

TIFF file.  Flate compressed format.

tifm1_mode2

Multipage TIFF file.  No compression.

tifm2_mode2

Multipage TIFF file.  Group 3, 1 dimensional fax format.

tifm3_mode2

Multipage TIFF file.  Group 3, 1 dimensional EOL fax format.

tifm4_mode2

Multipage TIFF file.  Group 3, 2 dimensional fax format.

tifm5_mode2

Multipage TIFF file.  Group 4 fax format.

tifm6_mode2

Multipage TIFF file.  JPEG compressed format.

tifm7_mode2

Multipage TIFF file.  LZW compressed format.

tifm8_mode2

Multipage TIFF file.  JBIG compressed format.

tifm9_mode2

Multipage TIFF file.  Flate compressed format.

xbm_mode2

XBM format

 

For mode 2, the -color and -bitsperpixel settings that are available for each file type is defined by the device.  If the -color and/or -bitsperpixel options are not specified, TwainSave will attempt to use the first available -color and/or -bitsperpixel setting that the file type will support.

 

Example:  Acquire to a BMP file format using the internal file support, and with the compression type as "none".

twainsave -filetype bmp1_mode2 -filename mytif.bmp

 


If the device cannot save to the file type specified, this will usually mean one of the following:

 

There was a general problem in saving the file (disk full, user does not have write access to the drive and directory, etc.) or
 
For Mode 2 files, the device cannot save to the desired format.

 

For Mode 1 files, the TWAIN device did not or could not acquire the image in the proper format.  For example, a Group 3 TIFF is specified (-filetype tif3), however the device acquired a color image.  Color images cannot be saved to Group 3 or Group 4 TIFF files.  You would see the following in a command-line window if the -verbose option is specified, or in the log file specified by -verboselog:

 

clip0021

 

The error states that the device is attempting to transfer 8 bit images (usually color or gray scale), but the image format specified (TIFF Group 3) does not support color or gray-scale images.

 

If the device's user interface is shown, the user may have chosen an incorrect type that matches the format given on the TwainSave command line.  Therefore it is highly recommended that if you plan to use TwainSave, and the device's user interface will be available to the user, to select a file format that gives you the most supported types of colors.  For example BMP supports both monochrome, gray-scale, and color images, as do all forms of TIFF except for Group 3, Group 4 TIFF, and TIFF-JPEG.

 

For Mode 1 file types, here are the list of file types and the bits-per-pixel supported for each one:

 

Below is a table describing the valid bit-depths for each file type:

 

File Type              Bit Depth

bmp

Any bit depth

ico*

8, 16, or 24

jpeg, jp2

8, 16, or 24

pcx        

1, 8 or 24

tga

8 or 24

tif1, tif2, tif5, tif7        

1, 4, 8, 16, or 24

tif3, tif4

1

tif6

8, 16, 24

emf, wmf

24

gif

1, 8

png

1, 8, 16, or 24

psd

24

pdf

1, 8, 16, 24

ps1, ps2

1, 8, 16, 24

wbmp

1, 8, 16, or 24

 

1 bit-per-pixel are monochrome (black/white) images.

4 bits-per-pixel are usually gray-scale images.

8 bits-per-pixel are usually gray-scale and 256 color images.

16 and 24 bits-per-pixel are usually color images.

 

Note:  Bit depths higher than 24 should be stored as bmp files.

 

* Non-Vista Windows ICON format is limited to images that have widths and heights less than 256 pixels.  Therefore ICO image file generation may require the -thumbnail option to scale the image to fit the ICO size limits.

 

For Mode 2 file types, the bits-per-pixel settings are device dependent.  Usually these settings match the Mode 1 settings for equivalent formats (for example TIFF), however it is up to the device as to the valid bit-depth settings.

 

Default Setting:

The image type is bmp (Windows BMP Mode 1).