If you followed Tip 154, on page 197, and Tip 11, on page 72, you'll already have come into contact with Imagemagick. This command-line program can do just about anything to images and you can learn more about it by viewing its man page (man imagemagick) or viewing its website: http://www.imagemagick.org/script/convert.php.
Perhaps one of the most useful functions it can perform, besides file format conversion and resizing, is to sharpen an image. Almost all images look better when sharpened, particularly if they're being shrunk for use in printing or use on websites. To sharpen an image, use the -sharpen command option with convert. The possible values to be used range from .1 up to 3. A value of around 1 gives good results.
The following will sharpen an image:
$ convert -sharpen 0x1 filename.bmp filename_sharpened.bmp
That's zero after sharpen and before x. Obviously, you should replace filename.bmp with the source image, and filename_sharpened.bmp with a name suitable for the new sharpened image.
Imagemagick can also be used to process lots of images at once (known as batch processing), although in that case the mogrify command must be used instead of the convert command. For example, to sharpen all the images in the current folder, type: $ mogrify -sharpen 0x1 *
Note that the original files will be overwritten with sharpened versions of themselves, so you might want to make backups first. mogrify can also be used in place of convert in the aforementioned tips to shrink/enlarge lots of images at once, or convert lots of images from one format to another.
If you want to view a PDF, simply use the evince program: evince file-name.pdf. This will open a program window showing the PDF file.
If you actually want to look at the PDF within the terminal window (or maybe in a virtual console), you'll first need to convert it to text. To do this, use the pdftotext program: pdftotext filename.pdf. This will create a .txt file containing the contents of the PDF. To view it, use the less command: lessfilename.txt.
To extract the images from the PDF, use the pdfimages command. You'll need to specify the filenames for the pictures, and also the -j command option to ensure the photographic images are outputted as JPEG. For example, the following:
$ pdfimages -j filename-pdf pictures
.. .will extract the images as JPEGs and give them filenames beginning with pictures. So the first might be pictures-001 .jpg, the second pictures-002.jpg, and so on.
You can also convert PDFs to images by following Tip 168, on page 205. For other PDF tips, see Tip 116, on page 164; Tip 189, on page 228; and Tip 258, on page 298.
You might have heard about Wine, the software that recreates much of the Windows infrastructure under Linux so you can run some Windows software (not, unfortunately, all Windows software; newer titles in particular tend to be non-starters. For details of the success or otherwise of particular Windows programs, see http://appdb.winehq.org).
There isn't space in a quick tips book like this to explain how to use Wine, but here are some tips:
• Wine can be installed by using Synaptic to search for and install the wine package. It's strongly advised you also install the msttcore-fonts package, to install the Windows fonts, and also the nas package, which provides enhanced sound support. However, Ubuntu versions can be a little behind the main Wine release, so you might want to add the official Wine repositories—see http://www.winehq. org/site/download-deb for details. However, don't assume that the newest version is always the best—sometimes newer releases break compatibility with some Windows programs. Often you upgrade at your peril!
• To run a Windows program, just download it (or insert the CD/DVD) and then precede its installation program filename with wine. For example, to run the WinZip installer, I typed wine winzipl 12.exe. See Figure 3.34 for an example.
• Wine creates a whole fake C:\ drive when it's first run, but it's hidden within your /home folder. To access it, type cd ~/.wine/.drive_c. Then, to run any program, for example those from the Program Files folder, once again precede their .exe filenames with wine. Remember that filenames including spaces need to be enclosed in quotation marks, for example: wine ".wine/drive_c/Program Files/Internet Explorer/iexplore.exe".
• If a Windows program prompts you to reboot, you don't actually have to reboot! Instead, issue the wineboot command at the terminal.
• Bear in mind that Wine likes to provide lots of debug feedback, in the form of worrying messages when it runs any Windows program. You can ignore this.
• The program Wine Doors makes setup and use of Wine much easier, providing a centralized GUI configuration program that will walk you through installing certain Windows applications. It can be downloaded from http://www.wine-doors.org. For best results, this should be installed before Wine is used for the first time, so it can setup things correctly.
• Lots of software won't install unless Internet Explorer is installed. This can be done using Wine Doors. Installing Internet Explorer using Wine Doors will also install other useful Windows software, such as the DCOM98 system files, which helps many programs work under Wine.
• Wine can be difficult to get the most from, so you might be interested to hear that a handful of commercially-sold versions are available that not only automate installation of popular applications but also iron-out some of the bugs that stop applications working. Crossover Office (http://www.codeweavers.com) will let you run many Windows applications and games, including many recent examples (including versions of Microsoft Office up to Office 2003), while Cadega (http://www.transgaming.com) concentrates on games.
If you want to uninstall Ubuntu, and have used Wubi, resist the temptation just to delete the C:\ubuntu folder. This will remove the Ubuntu system files but leave behind the boot menu entry. Instead, browse to C:\ubuntu and double-click Uninstall-Ubuntu.exe.
For other Wubu-related tips, see Tip 19, on page 77, and Tip 186, on page 226.
Was this article helpful?