Linux Know-How provides a collection of introductory texts on often needed Linux skills.


Graphics-related commands

kghostview my_file.ps

(in X terminal) Display a postscript (or pdf) file on screen. I can also use the older-looking ghostview or gv for the same end effect. I can print the postscript file from the viewer too.

xpdf my_file.pdf

(in X terminal) View a pdf file. For viewing pdf files, I prefer the Adobe Acrobat Reader for Linux (it is faster):

acroread my_file.pdf

It can be downloaded from: http://www.adobe.com/products/acrobat/readstep2.html

enscript my_file.txt -U 2

Convert a text file to postscript and print it to the default printer. I could also send the output to a postscript file:

enscript my_file.txt -U 2 -o my_file.ps

The option -U 2 makes enscript print 2 logical pages on one physical page which saves me paper, and creates more convenient, compact printouts. You may also select four pages per page, more makes the printout kind of difficult to read. enscript is really flexible, see man enscript to select from among the many formatting options.

ps2pdf my_file.ps my_file.pdf

Make a pdf (Adobe portable document format) file from a postscript file.

mpage -2 my_file.ps > new_file.ps

Print the postscript file my_file.ps, outputting two logical pages on one physical page. Save the output to the file new_file.ps.

ps2ps file.ps new_file.ps

psnup -nup 2 -pletter new_file.ps new_file2.ps

Another way of making a postscript file containing 2 logical pages on one physical page. First, I used the "postscript distiller" ps2ps to make the postscript file simpler (at the cost of it becoming much larger). Then, I used the psnup utility to make new_file2.ps which contains 2 logical pages per one physical page. I could have also put 4 or 8 logical pages per one physical page.

gimp

(in X terminal) A humble looking but very powerful image processor. Takes some learning to use, but it is great for artists, there is almost nothing you can't do with gimp. Use your mouse right button to get local menus, and learn how to use layers. Save your file in the native gimp file format *.xcf (to preserve layers for future editing) and only then flatten it and save as png (or whatever) for use. "Learning how to make proper selection is the key."

gphoto

(in X terminal) Powerful photo editor and camera image acquisition program.

kpaint

(in X terminal) Simple bitmap paint program ("paintbrush"-type).

xfig

(in X terminal) A simple drawing program. Useful for making elementary sketches or diagrams.

dia

(in X terminal) A tool for drawing diagrams from pre-built components.

display my_picture

(in X terminal) Display a picture for viewing only. You can also type display & and select file from the menu to view the image, rotate it , change its colour, apply certain effects, etc. display is part of ImageMagick package, together with several other utilities described below.

identify -verbose my_picture

Give me a description of an image file my_picture: format, type, class, size in pixels, number of colours, size in bytes, etc.

convert -geometry 60x80 my_picture.gif out_small_picture.gif

Scale a picture to a size 60x80 pixels. See a few line down for an example how to use convert to convert between different graphical file formats.

animate -delay 6x5 pic1 pic2 pic3

Keep showing two or more pictures in sequence. In the example above, the picture files are named pic1, pic2 and pic3, the delay between pictures is 0.06 second, and the whole presentation sequence is repeated in 5 seconds.

combine pic1 pic2 combined_pic.miff

Combine two or more images to another image. You can for example put a logo on every image.

montage -geometry 800x600+0+0 my_picture montage.miff

Create a tiled image from my_picture so that the total size is 800x600 pixels, with 0x0 border. The output goes to the file montage.miff.

zgv my_picture

Display a picture for viewing on a vga screen (no X necessary).

giftopnm my_file.giff > my_file.pnm

pnmtopng my_file.pnm > my_file.png

Convert the proprietary giff graphics into a raw, portable pnm file. Then convert the pnm into a png file, which is a newer and better standard for Internet pictures (better technically plus there is no danger of being sued by the owner of giff patents).

xwd -out my_cupture_screen_file.xwd

(in X terminal) Capture the contents of X-windows screen into a graphics X-windows "dump" file (*.xwd). You can later convert the xwd file into your favourite format using the convert utility. Unde KDE, you can also use the keyboard shortcuts <Alt><PrintScreen> or <Ctrl><Alt><PrintScreen> to copy the current window or the entire desktop into the clipboard.

convert my_capture_screen_file.xwd my_capture_screen.jpg

Convert the X-windows screen dump file (*.xwd) into the *.jpg file format. The convert utility can convert graphics from/to many different file formats.

import -display 192.5.100.10:0 -window root my_file.jpeg

Capture the contents of the root screen from X-windows running on server 192.5.100.10 display 0. The output file is my_file.jpeg (change the file format by giving it an appropriate filename extension). You need to have the permission to write to the screen in order to be able to capture its content (the permission to everybody can be given by running xhost + in the X-terminal). See man import for options.

ksnapshot

(in X terminal) GUI-based utility to capture screen contents.

xine frankenstein.avi &

(in X terminal). Watch the movie from the file "frankenstein.avi". Looks better than on a TV :))


Last Update: 2010-12-16