- Unix Commands Reference
- Unix Commands - Home
fax2ps Command in Linux
The fax2ps command in Linux converts a TIFF facsimile image into a PostScript file. PostScript is a page description language developed by Adobe that describes how text and images should be displayed or printed. It is specifically designed for printers, telling the printing device how to create a desired output.
The fax2ps command converts a TIFF fax (facsimile) file into a compressed PostScript. The PostScript is generated for viewing or printing purposes. Moreover, the TIFF facsimile can be archived in the compressed PostScript form using the fax2ps tool.
Table of Contents
Here is a comprehensive guide to the options available with the fax2ps command −
- Prerequisites to Use the fax2ps Command
- Syntax of fax2ps Command
- fax2ps Command Options
- Examples of fax2ps Command in Linux
Prerequisites to Use the fax2ps Command
The fax2ps tool is a part of the libtiff-tools package. Before using the fax2ps command, ensure the package is installed on Linux. To verify, use the following command −
which fax2ps
If the output shows the binary path, it means the fax2ps is installed. If it does not produce any output install the libtiff-tools package.
To install the fax2ps tool on Ubuntu, Debian, Kali Linux, and their flavors, use −
sudo apt install liftiff-tools
Syntax of fax2ps Command
The syntax of the Linux fax2ps command is as follows −
fax2ps [options] [file]
The [options] field in the above syntax is used to specify the various options to achieve specific functionality. While [file] field is used to specify the TIFF file or files.
fax2ps Command Options
The options used with the fax2ps command are listed in the following table −
Options | Description |
---|---|
-p number | Print only the specified page; multiple pages can be mentioned |
-x resolution | It is used to specify the horizontal resolution in dots/inch (by default it is taken from the file’s meta) |
-y resolution | It is used to specify the vertical resolution in dots/inch (by default it is taken from the file’s meta) |
-S | It is used to scale each page of the file to fill the output page dimensions (image size will scaled based on the output page, by default, the original size is displayed) |
-W width | It is used to specify the output page width in inches |
-H height | It is used to specify the output page height in inches |
Examples of fax2ps Command in Linux
This section demonstrates the usage of the fax2ps command in Linux with various examples. Before proceeding with the conversion, let's first check the information on the TIFF facsimile using the tiffinfo utility.
tiffinfo file.tiff
The tiffinfo command displays information about each page of a facsimile, as shown in the following output.
Displaying TIFF PostScript to Standard Output
To display the PostScript of a TIFF image file, use the fax2ps command with the TIFF file name −
fax2ps file.tiff
The explanation is as follows −
The first line %!PS-Adobe-3.0 indicates the PostScript version, which is 3.0 in this case. The second line specifies the application used to generate the file, which is the fax2ps command. The %%CreationDate shows the date the PostScript file was created.
The %%BoundingBox: 0 0 595 842 line defines the page dimensions in points, with 1 point equal to 1/72 inch. The coordinates represent the lower-left and upper-right corners of the page.
The %%Pages: (atend) line indicates that the number of pages will be specified at the end of the file. The end of the file will show the total number of pages.
The %%BeginProlog and %%EndProlog contain all the definitions and procedures of the page such as font, encoding, and various other parameters.
The %%Page: "1" 1 marks the beginning of the content of page 1.
Displaying the TIFF PostScript of Multiple Files
To save the PostScript of multiple files, mention file names after the fax2ps command −
fax2ps file1.tiff file2.tiff
Multiple TIFF files will be concatenated into a single PostScript file.
Saving the TIFF PostScript to a File
It is a good practice to save the output to a specific file. To save the TIFF image PostScript to a file, simply redirect the output to a file using the redirection operator (>) −
fax2ps file.tiff > file.ps
Use the ps extension for the output file.
Printing a Specific Page
A TIFF file can have multiple pages. To print or process a specific page, use the -p option with the page number.
fax2ps -p 2 file.tiff
Multiple pages can also be mentioned.
Specifying the Output Page Dimensions
To convert the TIFF file to a specific page dimension, use the -W and -H options. Note that the dimensions are mentioned in inches.
fax2ps -W 6 -H 10 file.tiff
In the above output, the dimensions are shown in pixels. 6 and 10 inches are equal to 432 and 720 pixels respectively with PPI 72.
Scaling the TIFF File to Fit Output Page
To scale the TIFF file to fit the output page, the -S option is used:
fax2ps -S file.tiff
The -S option scales the output to fit the page size.
To Convert the TIFF File to a Specific Resolution
To convert the TIFF file to a specific resolution, use the -x and -y options.
fax2ps -x 400 -y 800 file.tiff
The above command will change page resolution to 400 and 800 dots per inch horizontally and vertically respectively.
Conclusion
The fax2ps command line tool in Linux converts the TIFF facsimile into a compressed PostScript. The PostScript files can be used to print and archive the TIFF document. To use the fax2ps command, the libtiff-tools package must be installed. It contains various tools to read and modify the TIFF files.
In this tutorial, we explained the fax2ps command, its syntax, options, and usage through various examples.