Total Pageviews

Search: This Blog, Linked From Here, The Web, My fav sites, My Blogroll

Translate

01 September 2009

Ubuntu Multimedia

from
Beginning Ubuntu Linux From Novice to Professional
2006 by Keir Thomas

ISBN-13 (pbk) 978-1-59059-627-2

Digital Music


The Legalities of Playback
As you might have read in the press, multimedia playback on computer devices, and Linux in
particular, is hindered by a number of issues, including the following:
  • Software patents: Audio and video playback technologies such as MP3 and MPEG are patented in countries that allow software to be patented, such as the United States. A patent protects the implementation of an idea, as opposed to copyright, which protects the actual software. Patents are designed to restrict use of the technology unless permission is granted,usually via a payment to the license holder. Because Linux is based on the sharing of computing technology and knowledge, organizations like Ubuntu are fundamentally and philosophically opposed to any kind of software patenting. While this doesn’t make playback of popular music and video files impossible under Ubuntu, it does mean that extra software must be downloaded and installed. Furthermore, depending on where you live in the world, there may be legal issues surrounding using such patented software.
  • Digital Rights Management (DRM): Much more devastating than patenting is DRM, a technology tied into audio or video playback software. It’s designed to control how, where, when, and on what device you can play certain media. For example, Apple’s iTunes DRM scheme means you can play back MP3s bought from iTunes only on their iPod range of devices (including the Motorola Rokr phone) or using the iTunes software. DVD movie players include a form of DRM called Content Scrambling System (CSS), which prevents users from playing DVDs on computers unless special software is purchased. The Linux community, including the Ubuntu project, is fundamentally opposed to DRM. Because of this, practically no DRM software has been officially ported to Linux, so you can’t, for example, play music purchased via the iTunes or Napster online stores.
Linux and other open-source programmers are very resourceful and are often able to reverse-engineer technology formats in order to get around DRM or patent issues. But the laws in many countries—with the United States as a particularly strident example—prohibit reverse engineering in this way. In addition, the laws in some countries seek to prohibit use of software
resulting from this process.
Note : To learn more, and to find out what you can do to help halt the progress of such technology, visit the Electronic Frontier Foundation’s website.
Programmers have also come up with Free Software alternatives to proprietary formats.
Examples include the Ogg media format, which is every bit as good as MP3, but is unencumbered by patent issues.

At the moment, there’s no ideal open-source video format, or at least not one that’s in widespread use. Therefore, you’ll probably want to add support for MP3 and other popular music file formats. We’ll examine installing media playback software, some of which may have issues surrounding patenting. In one case, the software is designed to bypass the DRM scheme that protects DVD movie discs.
Note: The United States and Japan both have laws allowing software to be patented. Most other countries, including those within the European Union, do not currently allow software patents.


Playing Music Files

Music playback under Ubuntu is handled by the Rhythmbox player. Like many modern music players, Rhythmbox can also manage your music collection, arranging it into a library so you can locate songs easily. But before using Rhythmbox, you need to add support for MP3 and other popular music file formats.


Installing Codecs

The piece of software that handles the decoding (and also encoding) of digital music files is called a codec. The word is a shortened version of coder-decoder. For any digital multimedia file type you want to play back on your computer, you’ll need an appropriate codec that allows the decoding of files (This includes both audio and video files). In addition, if you wish to create your own multimedia files, you might need to download an additional codec that allows the encoding of files. The necessary audio and video codec software for playback can be found in Ubuntu’s online software repositories. To obtain them, open the Synaptic Package Manager(Settings ➤ Administration), click the Search button, and then type gstreamer. In the list of results, look for the following packages:
  • gstreamerx.x-plugins(good, bad, ugly)
  • gstreamerx.x-plugins-multiverse
  • gstreamerx.x-ffmpeg
The x.x represents the package version (that's time depended). Look for the newest versions.
Click the check box alongside each and select Mark for Installation. You’ll be told that each package needs additional software. Don’t worry—this is why I recommend these particular packages! The set of packages contain support for just about every form of audio playback possible on a PC (with the exception of DRM technology like the iTunes .m4p files). Click the Apply button, and the Synaptic Package Manager will download and install the software. Once this task has completed, quit the program.


Using Rhythmbox

You’ll find Rhythmbox on the Applications ➤ Sound & Video menu. The first time you run the program, it will ask you where your music files are stored. Simply click the Browse button, and then double-click the folder that holds those files. Then click OK. When the program starts, your music files are listed at the bottom of the program window. At the top left of the program window, you’ll find a listing of the artists behind the MP3s in your collection, and on the right, you’ll see the album that the music track is taken from (provided that information is included in the music file itself, such as the MP3 ID3 tags). Playing a track is simply a matter of double-clicking it in the list. Once the track is finished, Rhythmbox will play the next track in the MP3 file list.

To create a playlist:
  1. right-click under the Source heading on the left side of the program window and select New Playlist.
  2. Click the new entry to type its name.
  3. To add tracks to the playlist, click Library, and then drag-and-drop files onto your new playlist entry.
  4. To start the playlist, click the first track in its list.
Note: If whenever you double-clicked an MP3 in a Nautilus window, Ubuntu would try to start the Totem Movie Player or others rather than Rhythmbox: right-click any MP3 file, select Properties, and click the Open With tab. Then click the Add button, select Rhythmbox, and ensure that the radio button alongside its entry in the list is selected.

Listening to Audio CDs
Just insert the CD, and then click Applications ➤ Sound & Video ➤ CD Player. This will start Ubuntu’s simple but effective CD playback application. If you’re online, the application will immediately attempt to look up the CD artist and track listing information from an online repository. This means that it should show the names of the tracks being played.
Note: On one occasion during my testing, the online lookup resulted in several entries for a CD I was playing. All I had to do was choose the one. From then on, whenever I played that CD, the track listing I had chosen was used.
The controls work in the same way as those on any other audio player. The time display down toolbar of the program window shows the track’s progress.
Tip: As with all GNOME applications, hover the mouse cursor over each button to display a tooltip that describes what it does.
If you find the track listing information is incorrect, you can correct it by clicking Music>Properties Editor button(or right clik on track in tracks pane). In the window that appears, find the entry with the incorrect information and edit it as you see fit.


Tuning in to Online Radio Stations
You can listen to online radio stations (known as streaming audio) by downloading the Streamtuner software(or through Rhytmbox's FM Radio plugin). This isn’t an actual audio player, but is instead a kind of digital listings program that lets you search for stations to match just about any musical taste. It relies on the XMMS media player program to actually allow you to listen to the streams.
To obtain the software, open Synaptic Package Manager (Settings ➤ Administration), search for streamtuner, and mark it for installation. Then search for xmms and mark it for installation,
too. Click Apply to install all the packages.

Configuring XMMS
Before using XMMS, you’ll need to quickly reconfigure its sound output plug-in so that its volume control works properly. Here are the steps:
  1. Start XMMS by clicking its entry on the Applications ➤ Sound & Video menu.
  2. Right-click its title bar and select Options ➤ Preferences.
  3. In the dialog box that appears, look for the Output Plugin heading under the Audio I/O Plugins tab, and select eSound Output Plugin.
  4. Click OK, and then quit XMMS.
On my installation of Ubuntu, I also had to create a desktop shortcut for Streamtuner
because, for some reason, it wasn’t added to the Sound & Video submenu. If you need to do
this, right-click a blank spot on the desktop and select Create Launcher. In the Name box, enter
Streamtuner, and in the Command box, enter streamtuner. Click to add an icon, and then enter the following in the Path field of the icon selection dialog box:
/usr/share/streamtuner/python/icons/basic.ch.png.

Using Streamtuner
Using Streamtuner is easy. When it launches, click one of the tabs to browse through the stations. In addition, some tabs have subcategories of stations on the left. The Shoutcast tab probably contains the most comprehensive selection, but some people prefer Live365.
Double-click a stream to start it playing. Most streams will play in XMMS, which will start
automatically, but some are RealAudio streams, and you’ll need to have RealPlayer installed to
play them.


Ripping Music from CDs
Converting audio tracks on a CD into digital music files (Because of the way audio CDs work, you can’t simply insert the disc and then drag-and-drop the tracks onto your hard disk. They must be converted first.) you can store on your hard disk for personal use is informally known as ripping. It’s handled under Ubuntu using the Sound Juicer application, which can be found on the Applications ➤ Sound & Video menu. Before you start to rip CDs, however, you’ll need to decide the format in which you wish to store the audio files.

Choosing a Format

You have three basic choices for audio file formats:
  • Ogg Vorbis: This is the Free Software alternative to MP3. Unless you have a trained ear, you won’t be able to tell the difference between an Ogg and MP3 file (if you do have a
    trained ear, then you’ll find Ogg better!). The two technologies generate files of around the
    same size, an average of 4MB to 5MB per song. The downside of Ogg is that not many
    portable audio players support it (although this situation is slowly changing), and other
    operating systems like Windows won’t be able to play back Ogg files unless some additional
    software is installed.
  • FLAC: This stands for Free Lossless Audio Codec, and it’s the choice of the audiophile. Ogg
    and MP3 are lossy formats, which means that some of the audio data is lost in order to
    significantly shrink the file. FLAC doesn’t lose any audio data but still manages to compress
    files to a certain degree (although they’re still much larger than an equivalent MP3 or Ogg
    file). FLAC scores points because it’s Free Software, like Ogg, but you’ll face the same lack
    of support in portable audio players and other operating systems (unless additional software is installed).
  • MP3: This is by far the most ubiquitous music file format and practically everyone who owns a computer has at least a handful of MP3 tracks. This means software support for
    MP3 playback is strong and, of course, portable audio players are built around the MP3
    format. The only problem for you, as a Linux user, is the issue of surrounding patents, as
    explained above. Using the MP3 format is to go against a lot of what the Free Software movement stands for. But in the end, the choice is up to you.

Adding MP3 Support to Sound Juicer
Support for Ogg and FLAC is built into Ubuntu, but if you wish to encode CD tracks as MP3s,
you’ll need to enter some configuration details into Sound Juicer(The software that’s required to encode MP3s is installed with the gstreamer packages. If you didn’t already download them, follow the instructions earlier).
Follow these steps to configure MP3 support:
  1. Select Applications ➤ Sound & Video ➤ Sound Juicer to start the program.
  2. Click Edit ➤ Preferences. In the dialog box that appears, click the Edit Profiles button.
  3. Click New, and then type MP3. Then click Create.
  4. Select the new MP3 entry in the list and click Edit.
  5. In the Profile Name box, type MP3.
  6. In the Profile Description box, type MP3.
  7. In the GStreamer Pipeline box, type the following:audio/x-raw-int,rate=44100,channels=2 ! lame name=enc
  8. In the File Extension box, type mp3.
  9. Put a check in the Active? box.
  10. Click OK.
  11. Restart Sound Juicer.
  12. Click Edit ➤ Preferences again, and select your new MP3 entry from the Output dropdown list.

Ripping Tracks

When you’re ready to rip some music, insert the audio CD, and then start Sound Juicer.
  1. If the CD isn’t read immediately, click Disc ➤ Re-read. As with CD Player, Sound Juicer will automatically look up the artist and track information of the CD.
  2. Click Edit ➤ Preferences. In the Format part of the dialog box, choose the type of audio files you want to create. In addition, you can select where you would like the files to be saved to by clicking the drop-down list under the Music Folder heading. Any track in the listing with a check in its box will be ripped.
  3. When you insert a CD, Sound Juicer assumes that all the tracks are to be ripped.
  4. If this isn’t the case, remove the checks from the tracks you don’t want to rip. By selecting a track and clicking the Play button, you’ll be able to audition the track. This can be helpful if you’re deciding on exactly which tracks to rip.
  5. Finally, check that the Title and Artist information is correct.
MAKING MUSIC AND RECORDING AUDIO
Most PCs come with sound cards that are capable of making music. You can use many open-source programs, designed for both amateurs and professionals alike, to create music or record and edit audio. In terms of musical sequencers, Muse, Rosegarden, and Jazz++ are well worth investigating. Like all modern MIDI sequencers, all three programs let you record audio tracks, effectively turning your PC into a recording studio. It’s also possible to run virtual synthesizers on your PC, which effectively turn even the most basic sound card into a powerful musical instrument. Examples include Bristol and FluidSynth. If you’re interested in only audio recording and processing, Sweep and Audacity are worth a look. In addition to audio recording and playback, both feature graphical waveform editing and powerful filters. Most of the packages mentioned here are available from the Ubuntu software repositories, and you can
download them with the Synaptic Package Manager.


Creating Your Own CDs

You can create audio CDs by using the Serpentine Audio-CD Creator program, found on the
Applications ➤ Sound & Video menu. Start by inserting a blank CD. Almost immediately, Ubuntu will ask what you want to do with the disc via a dialog box. If you choose Burn an Audio CD, Serpentine will open automatically. The program is very simple to use.
  1. Click the Add button on the toolbar, and then browse to your store of files (these can be MP3, Ogg, or any other file format supported by Ubuntu).
  2. Then select the tracks you wish to go onto the CD. Shift-click to select many tracks at once, as with Windows, or hold down Ctrl and click multiple individual tracks.
  3. After clicking Open to add the tracks, you’ll see the track listing build up in the Serpentine program window. In addition, a small graphic of CD will also fill up, like a pie chart, showing how much space is left on the CD. You can rearrange the track listing by clicking and dragging the tracks to new locations.
  4. When you’re happy with the track listing, click the Write to Disc button to start the write procedure(Depending on the quality of the blank CD, you might not be able to write audio CDs at full speed. If this is the case, Serpentine will stop during the writing process with an error message. Click Edit ➤ Preferences on the menu and click the radio button next to Choose Writing Speed. Then enter a more conservative speed). First, the tracks are converted to pure audio files, and then they’re actually burned to disc. This can take some time. When Serpentine finishes with the burning, the CD will be ejected.


Movies and Multimedia


Ubuntu provides support for movie playback but, as with audio support, you’ll need to install additional codecs in order to enjoy the broadest range of playback options.


Watching Videos
You use the Totem Movie Player application to play back video under Ubuntu. Like the other multimedia software provided with Ubuntu, it’s basic but effective and does the job well. However, because of licensing issues, it doesn’t support all video formats out of the box. In fact, it supports very few of those you might be used to using under Windows. If you wish to play back the most common video file types, such as those listed in Table, you must install additional software. This software contains codecs that allow you to play
movie files under Ubuntu. In addition, you’ll need to make some updates to Totem.
Caution: The codecs are quite literally lifted straight from a Windows installation. Therefore, you should install them only if you own a license for Windows and have also installed the relevant media player applications under Windows and agreed to their license agreements.
After following the instructions in this section, you will be able to play video files on your
hard disk and also stream video from web sites within Firefox.


Installing Codecs

For video playback, you need the codecs described in the previous chapter, as well as a few more. If you haven’t followed the instructions in the previous chapter and downloaded the various packages mentioned there, do that first. Then follow these steps to install the additional codecs required:
  1. Select System ➤ Administration ➤ Synaptic Package Manager.
  2. Click Search and search for totem-xine. Click its check box in the results, mark it for
  3. installation, and then click Apply.
  4. 3. Select Applications ➤ Accessories ➤ Terminal and, in the GNOME Terminal window,
  5. enter the following in sequence, pressing Enter after each line:
    1. wget ftp://ftp.nerim.net/debian-marillat/pool/main/w/w32codecs/w32codecs_20050412-0.0_i386.deb
    2. sudo dpkg -i w32codecs_20050412-0.0_i386.deb
    3. gst-register-0.8
  6. Close the terminal window. Log out, and then log back in again.

Installing RealPlayer
If you wish to install RealPlayer, head over to www.real.com and follow the download links for
the latest free Linux player. Download it, open a GNOME Terminal window (Applications ➤ Accessories ➤ Terminal), and type the following (replacing filename with the name of the RealPlayer file):

chmod +x filename
sudo ./filename

During installation, you’ll be asked various questions. When asked where you would like to install RealPlayer, type /usr/bin/RealPlayer (don’t agree to using the default path!). Answer yes to creating symbolic links, and agree to the default location for the links. In my tests, I found it was necessary to restart the computer after installation to avoid unreliable playback in RealPlayer.

Playing Back Video
To play a movie file on your hard disk, simply double-click its icon. This will automatically start
Totem.
Note: By default, all video files will play in Totem, including RealMedia. To change this so that RealPlayer handles them, right-click any RealPlayer movie file, select Open With, and click Add. Locate RealPlayer in the list, click the Add button, and then make sure the radio button alongside RealPlayer is selected.

Using Totem is easy. At the bottom left of the screen are the transport controls that allow you to pause, play, or move forward and backward in the video file. Alternatively, you can rightclick the video window and select the controls from there. Above the controls is the Time bar. With certain types of video, you can drag-and-drop this to move through the video, but not all files support this function. At the right of the program window is a playlist. You can queue several video files to be played in sequence by simply dragging-and-dropping movies from a Nautilus file browser window. To play the video full screen, tap the F key. To return to the program window, press Escape(Esc). In full-screen mode, you can start and stop the video by pressing the spacebar.

You can hide the playlist by clicking the Sidebar button. This gives nearly all of Totem’s program window to the playback window, but you might need to resize the window for the video to update to the new dimensions.
Tip: If you find you have problems with video playback, such as Totem showing an error message about another application using the video output, try the following: click System ➤ Preferences ➤ Multimedia Systems Selector. Click the Video tab, and in the Default Sink/Output drop-down list, select Xwindows (No XV). Click Test. If this doesn’t work, try the SDL – Simple DirectMedia Layer instead.

OPEN-SOURCE MOVIE FILE FORMATS
A number of promising open-source movie file formats are in development. Some are more mature than others, but few see widespread use at the moment. All promise much for the future. Many consider the following three formats as the chief contenders.
XviD is a reworking of the popular DivX MPEG-4-based file format. As such, it is able to encode movies to relatively small files sizes (a 90-minute movie can fit on a CD). Despite small file sizes, it can maintain good image and sound quality. In theory, it should also be possible to play XviD movies using any MPEG-4 codec, such as DivX or QuickTime. Unfortunately, XviD uses technology covered by patents in some parts of the world, so the project exists in a legally gray area. Additionally, it’s only possible to download a Windows version of the codec, although if you follow the instructions at
the beginning ealier, you will be able to download the ported Windows version of the codec so you can play XviD files under Ubuntu.
Ogg Theora is being developed by the Xiph.org Foundation, the people behind the
Ogg Vorbis audio codec project that’s a favorite among Linux users. As such, it promises to be a completely open-source project. Although the technology is covered by patents, Xiph.org has promised never to enforce them, meaning that anyone in the world can use Theora without charge. It will almost certainly become the opensource
video codec of choice in the future.
The British Broadcasting Corporation the UK’s largest public service broadcaster, is
sponsoring development of the Dirac codec. Dirac is less developed than both Theora and XviD at present, and it is aimed more at the broadcast/enthusiast market. For example, it is designed to support high-definition TV. However, it’s certainly one to watch.


Watching DVDs

DVD movie discs are protected by a form of Digital Rights Management (DRM) called Content
Scrambling System (CSS). This forces anyone who would like to create DVD playback software
or hardware to pay a fee to the DVD Copy Control Association, an industry organization set up
to protect DVD movie technology.

Nearly all Linux advocates are scornful of any kind of DRM system. It isn’t possible to buy licensed DVD playback software for Linux but, even if it were, few would be willing to support
what they see as prohibitive software technology. Some open-source advocates reverse-engineered DVD and came up with the DeCSS software. This bypasses the CSS system and allows the playback of DVD movies under practically any operating system. Sadly, DeCSS is caught in a legal quagmire. The Motion Picture Association of America (MPAA) has attempted to stop its distribution within the United States but has failed. Some experts suggest that distributing DeCSS breaks copyright laws, but there has yet to be a case anywhere in the world that categorically proves this. Nor has there been a case proving or even suggesting that using DeCSS is in any way illegal.

Ubuntu doesn’t come with DeCSS installed by default, but you can download and install the software by issuing a simple command. Here is the procedure:
  1. Select System ➤ Administration ➤ Synaptic Package Manager.
  2. Click Search and search for libdvdread. If the package isn’t already installed, click its check box and mark it for installation. Then click Apply. Close Synaptic Package Manager.
  3. Open a GNOME Terminal window (Applications ➤ Accessories ➤ Terminal). Type the following in the terminal window to download and install the DeCSS component:
    sudo /usr/share/doc/libdvdread3/examples/install-css.sh
After you’ve installed DeCSS, just insert a DVD, and Totem will automatically start playing it. Alternatively, if Totem is already open, you can play the DVD by clicking its entry on the File menu. Playing a DVD is not dissimilar to watching movie files on your hard disk. The only difference is that you can now navigate from chapter to chapter on the DVD by clicking the relevant entry under the Go menu. You can also return to the DVD’s main menu this way. You can use your mouse to click entries in DVD menus.


Playing Flash Animations
The Flash Player is a standard fixture on most modern browsers. It allows access to not only
animations, but also to interactive web sites and games. Macromedia makes a player especially for Linux, and you can download it from the Ubuntu software repositories. To install the Flash Player, open Synaptic Package Manager (System ➤ Administration) and search for flashplayer-mozilla. Then mark it for installation and click Apply. Once installation has finished, log out and then back in again. Configuration is automatic, and you should now be able to visit any Flash site with Firefox.
Tip: If you have problems with sound playback when watching Flash animations, try the following: open a GNOME Terminal window (Applications ➤ Accessories ➤ Terminal), and then type
ssudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1
Then log out of Ubuntu and back in again.
Sadly, there isn’t a Linux version of the Shockwave Director browser plug-in. If you really
need to be able to have access to Shockwave sites under Linux, considering using CrossOver
Office
to install the Windows version. But be aware that CrossOver Office is commercial product, and you’ll need to pay for it.

Some sites use Java to present interaction, animation, and even movies. You can install the
Java Runtime program by searching for j2re within the Synaptic Package Manager. In the list
of results, click to mark for installation both the main j2re package and eventually the mozilla-plugin package for j2re. When both are installed, log out and then back in again.
MOVIE EDITING
The field of Linux movie-editing software is still young, and only a handful of programs are available for the non-professional user. One of the best is Kino, which is available in the Ubuntu software archives. Although far from being a professional- level program, Kino allows competent users to import and edit videos, apply effects, and then output in either MPEG-1 or MPEG-2 format. If you’re looking for something more powerful, but also more complicated, then Cinelerra is well worth a
look. To quote the web site, Cinelerra is “the same kind of compositing and editing suite that the big boys use,” except it’s made for Linux! Sadly, Cinelerra isn’t in the Ubuntu repository and, at the time of writing, there wasn’t a Ubuntu-compatible package at the web site. However, a sister project that is based on Cinelerra Cinelerra-CV—contains a Debian package that should work fine on Ubuntu. MainActor is the Linux version of a commercial Windows project. Although it’s not free, most people agree that it’s one of the most comprehensive video editors available for Linux at the moment, and possibly the easiest to use, too. Incidentally, professional moviemakers use Linux all the time, particularly when it comes to adding special effects to movies. Movies like Shrek 2, Stuart Little, and the Harry Potter series all benefited from the CinePaint software running under Linux!


Watching TV
If you have a TV card, you may be able to use it to watch TV under Ubuntu. Ubuntu doesn’t come with a TV tuner application by default, but you can download the tvtime program from
the software repositories using the Synaptic Package Manager.

Checking for Video Input

Ubuntu includes the Video for Linux(v4l, v4l2) project, an extension to the Linux kernel to allow many popular TV and video-capture cards to work. You can find out if yours is compatible by clicking System ➤ Preferences ➤ Multimedia Systems Selector. In the dialog box that appears, click the Video tab, and then click the Test button in the Default Source part of the window. If you see a video window without an error message, then your TV card is compatible. If you receive an error message, try a different input setting from the drop-down list and click Test again.

Installing Tvtime
To download and install tvtime, open Synaptic Package Manager (System ➤ Administration),
click the Search button, and enter tvtime as a search term. In the list of results, click the entry
for tvtime and mark it for installation. Then click Apply. When the download has completed, you’ll be asked a number of questions during the configuration process.
  1. First, you need to choose your TV picture format. Users in the United States should choose NTSC. Users in the United Kingdom, Australia, and certain parts of Europe should choose PAL. To find out which TV system your country uses, look up your country here .
  2. You also need to choose your geographical area from the list so that tvtime can set the correct radio frequency range for your TV card.
Once the program is installed, you’ll find it on the Applications ➤ Sound & Video menu.
Using the program is straightforward, but if you need guidance, visit the program’s web site.


Image Editing


The PC has become an increasingly useful tool in the field of photography. Ubuntu includes a sophisticated and professional-level image-editing program called The GIMP(GNU Image Manipulation Program).


Getting Pictures onto Your PC
Before you can undertake any image editing, you need to transfer your images to your PC. Depending on the source of the pictures, there are a variety of ways of doing this. Let’s briefly recap the procedure here.

Most modern cameras use memory cards to store the pictures. If you have such a model, when you plug the camera into your PC’s USB port, you should find that Ubuntu instantly recognizes it. An icon should appear on the desktop, and double-clicking it should display the memory card in a Nautilus window. Technically speaking, the memory card has been mounted. If your camera doesn’t appear to be recognized by Ubuntu, you should consider buying a USB card reader. These devices are typically inexpensive and can read a wide variety of card types, making them a useful investment for the future. Some new PCs even come packaged with card readers. Most generic card readers should work fine under Linux, as will most new digital cameras. If your camera isn’t recognized, however, or if it’s a few years old and uses the serial port to connect to your PC, you can try using the gThumb software (Applications ➤ Graphics ➤gThumb Image Viewer).

If you’re working with print photos, negative film, or transparencies, you can use a scanner to scan them in using the XSane image scanning program. This works in a virtually identical way to the TWAIN modules supplied with Windows scanners, in that you need to set the dots per inch (DPI) figures, as well as the color depth. Generally speaking, 300 DPI and 24-bit color should lead to a true-to-life representation of most photos (although because of their smaller size, transparencies or negative film will require higher resolutions, on the order of 1,200 or 2,400 DPI).


Introducing The GIMP
The GIMP is an extremely powerful image editor that offers the kind of functions usually associated with top-end software like Adobe Photoshop. Although it’s not aimed at beginners, those new to image editing can get the most from of it, provided they put in a little work.

The program relies on a few unusual concepts within its interface(The GIMP’s way of working is referred to as a Single Document Interface, or SDI. It’s favored by a handful of programs that run under Linux and seems to be especially popular among programs that let you create things.), which can catch many people off guard. The first of these is that each of the windows within the program, such as floating dialog boxes or palettes, gets its own Panel entry. In other words,
  • The GIMP’s icon bar
  • image window
  • settings window
and so on have their own buttons on the bottom Panel alongside your other programs, as if they were separate programs.

Because of the way that The Gimp runs, before you start up the program, it’s a wise idea to switch to a different virtual desktop , which you can then dedicate entirely to The GIMP.
Click Applications ➤ Graphics ➤ GIMP Image Editor to run The Gimp. When the program starts for the first time, it will run through its setup routine. Usually, you can use the default answers to the various questions asked by the wizard.

After program has setup, you’ll be greeted by what appears to be a complex assortment of program windows. Now you need to be aware of a second unusual aspect of the program: its
reliance on right-clicking. Whereas right-clicking usually brings up a context menu offering a handful of options, within The GIMP, it’s the principal way of accessing the program’s functions. Right-clicking an image brings up a menu offering access to virtually everything you’ll need while editing. Ubuntu includes the latest version of The GIMP, 2.6.6, and this features a menu bar in the main image-editing window. This is considered sacrilege by many traditional The GIMP users, although it’s undoubtedly useful for beginners.

However, the right-click menu remains the most efficient way of accessing The GIMP’s tools. The main toolbar window, shown in Figure 20-1, is on the left. This can be considered the heart of The GIMP because, when you close it, all the other program windows are closed, too.
The menu bar on the toolbar window offers most of the options you’re likely to use to start out with The GIMP. For example, File ➤ Open will open a browser dialog box in which you can
select files to open in The GIMP. It’s even possible to create new artwork from scratch by choosing File ➤ New, although you should be aware that The GIMP is primarily a photo editor. To create original artwork, a better choice is a program like OpenOffice.org Draw (on the Applications ➤Office menu). Beneath the menu bar in the main toolbar window are the tools for working with images. Their functions are described below, which lists the tools in order from left to right, starting at the top left.
  • Rectangular selection tool Click and drag to select a rectangular area within the image. This selected area can then be copied and pasted into a different part of the image or turned into a new layer.
  • Elliptical selection tool Create an oval or circular selection area within the image, which you can then copy and paste.
  • Hand-drawn selection tool Click and draw with the mouse to create a hand-drawn selection area. Your selection should end where it started. If not, The GIMP will draw a straight line between the start and end of the selection.
  • Contiguous regions selection tool Known as the “magic wand” in other image editors, this tool creates a selection area based on the color of the pixels where you click. For example, clicking on a red car hood will select most, if not all of the hood, because it is mostly red.
  • Color region selection tool This tool works like the contiguous region selection tool, but will create a selection across the entire image based on the color you select. In other words, selecting a black T-shirt will also select a black signpost elsewhere in the picture if the shades are similar.
  • Shape selection tool Another “magical” tool, the shape selector lets you create a selection by clicking on various points within an image, with the program joining the points together based on the color differences between the two points. This means that you can select the outline of a car by clicking a few points around the edge of the car and, provided the color of the car is different from the background, The GIMP will work out the color differences and select the car’s shape automatically.
  • Path creation tool This tool draws Bezier curves in order to create paths. Paths are akin to selections and can be saved for use later on in the image-editing process. Creating a Bezier curve is not too hard to do: just click and drag to draw a curve. Each extra click you make will define a new curve, which will be joined to the last one. To turn the path into a selection, click the button at the bottom of the toolbar.
  • Color picker This lets you see the RGB, HSV, or CMYK values of any color within the
    image. Simply click the mouse within the image.
  • Zoom tool Click to zoom into the image, right-click to see various zoom options, and hold down the Alt key while clicking to zoom out.
  • Measurer This tool measures distances between two points (in pixels) and also angles. Just click and drag to use it. The measurements will appear at the bottom of the image window.
  • Move tool Click and drag to move any selection areas within the image, as well as
    rearrange the positioning of various layers.
  • Crop tool Click and drag to define an area of the image to be cropped. Anything outside the selection area you create will be discarded.
  • Rotate tool This tool rotates any selections you make and can also rotate entire layers. It opens a dialog box in which you can set the rotation manually. Alternatively, you can simply click and drag the handles behind the dialog box to rotate by hand.
  • Scale tool Known in some other image editors as “transform,” this tool lets you resize
    the selection area or layer. It presents a dialog box where you can enter numeric values, or you can click and drag the handles to resize by hand.
  • Shear tool This tool lets you transform the image by shearing it. Slant a selection by
    clicking and dragging the corners of the selection area (if the selectionarea isn’t square, a rectangular grid will be applied to it for the purposes of transformation).
  • Perspective tool This tool lets you transform a selection by clicking and dragging its four
    corners and independently moving them without affecting the other corners. In this way, a sense of perspective can be emulated.
  • Flip tool This tool flips a selection or image so that it is reversed on itself, either
    horizontally (click) or vertically (hold down Ctrl and click).
  • Text tool Click on the image to add text.
  • Fill tool Fill a particular area with solid color, according to the color selected in the color box below.
  • Gradient fill This tool will create a gradient fill based on the foreground and background
    colors by clicking and dragging.
  • Pencil tool This tool lets you draw individual pixels when zoomed in, or hard-edge lines when zoomed out. Simply click and drag to draw freehand, and hold down Shift to draw lines between two points.
  • Brush tool This tool lets you draw on the picture in a variety of brush styles to create artistic effects. A brush can also be created from an image, allowing for greater versatility.
  • Erase tool Rather like the Brush tool in reverse, this tool deletes whatever is underneath
    the cursor. If layers are being used, the contents of the layer beneath will become visible.
  • Airbrush tool This tool is also rather like the Brush tool, in that it draws on the picture
    in a variety of styles. However, the density of the color depends on the length of time you press the mouse button. Tap the mouse button, and only a light color will appear. Press and hold the mouse button, and the color will become more saturated.
  • Ink tool This tool is like the Brush tool except that, rather like an ink pen, the faster you draw, the thinner the brush stroke is.
  • Pattern stamp Commonly known as the clone tool, this is a popular image-editing tool.
    It is able to copy one part of an image to another via drawing with a brush like tool. The origin point is defined by holding down Ctrl and clicking.
  • Blur/sharpen tool Clicking and drawing on the image will spot blur or sharpen the image, depending on the settings in the tool options area in the lower half of the toolbar.
  • Smudge tool As its name suggests, clicking and drawing with this tool will smudge the
    image, rather like rubbing a still-wet painting with your finger (except slightly more precise).
  • Burn and dodge tool This tool lets you spot lighten and darken an image by clicking and
    drawing on the image. The results depend on the settings in the tool options part of the window.
Directly beneath the image-editing tool icons, on the right, is an icon that shows the foreground
and background colors that will be used when drawing with tools such as the Brush. To define a new color, double-click either the foreground (top) or background (bottom) color box.

To the left is the pattern selector, which lets you choose which patterns are used with tools such as the Brush.

Beneath these icons, you’ll see the various options for the selected tool. By using the buttons at the bottom of the window, you can save the current tool options, load tool options, and delete a previously saved set of tool options. Clicking the button on the bottom right lets you revert
to the default settings for the tool currently being used (useful if you tweak too many settings!).
Next to the toolbar window is the Layers dialog box. This can be closed for the moment, although you can make it visible again later, if you wish.


Editing Images with The GIMP
After you’ve started The GIMP (and assigned it a virtual desktop), you can load an image by selecting File ➤ Open. The browser dialog box offers a preview facility on the right of the
window. You will probably need to resize the image window so that it fits within the remainder of
the screen. You can then use the Zoom tool to ensure that the image fills the editing window, which will make working with it much easier. You can save any changes you make to an image by right-clicking it and selecting File ➤ Save As. You can also print the image from the same menu.
Before you begin editing with The GIMP, you need to be aware of some essential concepts that are vital to understand in order to get the most from the program:

Copy, cut, and paste buffers: Unlike Windows programs, The GIMP lets you cut or copy many selections from the image and store them for use later. It refers to these saved selections
as buffers, and each must be given a name for future reference.
  • A new buffer is created by selecting an area using any of the selection tools, then right-clicking within the selectionarea and selecting Edit ➤ Buffer ➤ Copy Named (or Cut Named).
  • Pasting a buffer back is a matter of right-clicking the image and selecting Edit ➤ Buffer ➤ Paste Named.
Paths: The GIMP paths are not necessarily the same as selection areas, although it’s nearly always possible to convert a selection into a path and vice versa (right-click within the selection or path and look for the relevant option on the Edit menu). In general, the tools used to create a path allow the creation of complex shapes rather than simple geometric shapes(Paths allow for more elaborate and intricate selections, such as those that involve curves.), as with the selection tools. You can save paths for later use.
  • To view the Paths dialog box, right-click the image and select Dialogs ➤ Paths.
Tip: Getting rid of a selection or path you’ve drawn is easy. In the case of a path, simply click on any other tool. This will cause the path to disappear. To get rid of a selection, select any selection tool and quickly click
once on the image, being careful not to drag the mouse while doing so.
Layers: In The GIMP (along with most other image-editing programs), layers are like transparent sheets of plastic that are placed on top of the image. Anything can be drawn on each individual transparent sheet, and many layers can be overlaid in order to create a complicated image. Layers also let you cut and paste parts of the image between them. It’s also possible to apply effects and transformations to a single layer, rather than to the entire image. The Layers dialog box, shown in Figure 20-3, appears by default, but if you closed it earlier, you can open it again by right-clicking the image and selecting Dialogs ➤ Layers.

The layers can be reordered by clicking and dragging them in the dialog box. In addition,
the blending mode of each layer can be altered. This refers to how it interacts with the layer below it. For example, its opacity can be changed so that it appears semitransparent, thereby showing the contents of the layer beneath.

Making Color Corrections
The first step when editing most images is to correct the
  • brightness
  • contrast and
  • color saturation.
This helps overcome some of the deficiencies that are inherent in digital photographs or scanned-in images. To do this, right-click the image and select Layers ➤ Colors. You’ll find a variety of options to let you tweak the image, allowing you a lot of control over the process. For trivial brightness and contrast changes, selecting the Brightness/Contrast menu option will open a dialog box where clicking and dragging the sliders will alter the image. The changes you make will be previewed on the image itself, so you should be able to get things just right. Similarly, the Hue/Saturation option will let you alter the color balance and also the strength of the colors (the saturation) by clicking and dragging sliders. By selecting the color bar options at the top of the window, you can choose individual colors to boost. Clicking the Master button will let you once again alter all colors at the same time. The trouble with clicking and dragging sliders is that it relies on human intuition. This can easily be clouded by a badly calibrated monitor, which might be set too dark or too light.

Because of this, The GIMP offers another handy option: Levels. To access the Levels feature, right-click the image and select Layer ➤ Colors ➤ Levels. This presents a chart of the brightness levels in the photo and lets you set the dark, shadows, and highlight points. Three sliders beneath the chart represent, from left to right, the darkest point, the midtones (shadows), and the highlights within the picture. The first step is to set the dark and light sliders at the left and right of the edges of the chart. This will make sure that the range of brightness from the lightest point to the darkest point is set correctly. The next step is to adjust the middle slider so that it’s roughly in the middle of the highest peak within the chart. This will accurately set the midtone point, ensuring an even spread of brightness across the image. A little artistic license is usually allowed at this stage and, depending on the effect on the photo, moving the midtone slider a little to the left and/or right of the highest peak might produce more acceptable results. However, be aware that the monitor might be showing incorrect brightness/color values.

Cropping and Cloning
After you’ve adjusted the colors, you might want to use the Crop tool to remove any extraneous details outside the focus of the image. For example, in a portrait of someone taken from a distance away, you might choose to crop the photo to show only the person’s head and shoulders, or you might separate a group of people from their surroundings. You might also want to use the Clone tool to remove facial blemishes. Start by using the Zoom tool to close in on the area. If the blemish is small, you might need to zoom in quite substantially. Then try to find an area of skin that is clear and from which you can copy. Hold down Ctrl and click in that area. Then click and draw over the blemish. The crosshair indicates the area from which you’re copying.

Sharpening
One final handy trick employed by professional image editors to give their photos a shot in the
arm is to use the Sharpen filter. This has the effect of adding definition to the image and negating
any slight blur caused by things such as camera shake or poor focusing. To apply the Sharpen
filter, right-click the image and select Filters ➤ Enhance ➤ Sharpen.
A small preview window will show the effect of the sharpening on the image (you might need to use the scroll bars to move to an appropriate part of the image). Clicking and dragging the slider at the bottom of the dialog box will alter the severity of the sharpening effect. Too much sharpening can ruin a picture, so be careful. Try to use the effect subtly.The Sharpen filter is just one of many filters you can apply in The GIMP.


Applying Filters
Like other image-editing programs, The GIMP includes many filters to add dramatic effects to your images with little, if any, user input. Filters are applied either to the currently selected layer or to a selection within the layer. To apply a filter, right-click the image and choose the relevant menu option. If you don’t like an effect you’ve applied, you can reverse it by selecting Edit ➤ Undo, or by pressing Ctrl+Z. The submenus offer filters grouped by categories, as follows:

Blur: These filters add various kinds of blur to the image or selection. For example, Motion
Blur can imitate the effect of photographing an object moving at speed with a slow shutter. Perhaps the most popular blur option is Gaussian Blur, which has the effect of applying a soft and subtle blur.

Color: This option includes many technical filters, mostly of interest to image technicians
or those who want to uncover and otherwise manipulate the color breakdown within an
image. However, Filter Pack might appeal to the general user. This filter can quickly adjust
the hue, saturation, and other values within the image. Also of interest is Colorify, which
can tint the image to any user-defined color.

Noise: This collection of filters is designed to add speckles or other types of usually unwanted
artifacts to an image. These filters are offered within The GIMP for their potential artistic effects, but they can also be used to create a grainy film effect—simply click Scatter RGB.

Edge Detect: This set of filters can be used to automatically detect and delineate the edges
of objects within an image. Although this type of filter can result in some interesting results that might fall into the category of special effects, it’s primarily used in conjunction with other tools and effects.

Enhance: The Enhance effects are designed to remove various artifacts from an image or otherwise improve it. For example, the Despeckle effect will attempt to remove unwanted
noise within an image (such as flecks of dust in a scanned image). The Sharpen filter discussed in the previous section is located here, as is the Unsharp Mask, which offers a high degree of control over the image-sharpening process.

Generic: In this category, you can find a handful of filters that don’t seem to fall into any other category. Of particular interest is the Convolution Matrix option, which lets you create your own filters by inputting numeric values. According to The GIMP’s programmers, this is designed primarily for mathematicians, but it can also be used by others to create random special effects. Simply input values and then preview the effect.

Glass Effects: As the name suggests, these filters can apply effects to the image to imitate the effects that come about when glass is used to produce an image. For example, the Apply Lens filter will apply the same kind of distortion caused by various wide-angle lenses used on cameras.

Light Effects: Here, you will find filters that imitate the effects that light can have on a picture, such as adding sparkle effects to highlights or imitating lens flare caused by a camera’s lens.

Distorts: As the name of this category of filters suggests, the effects here distort the image in various ways. For example, Whirl and Pinch allow you to tug and push the image to distort it (to understand what is meant here, imagine the image is printed on rubber and then pinching or pushing the surface). This category also contains other special effects, such as Pagecurl, which imitates the curl of a page at the bottom of the picture.

Artistic: These filters allow you to add painterly effects to the image, such as making it appear as if the photo has been painted in impressionistic brushstrokes, or as if it were painted on canvas by overlaying the texture of canvas onto the picture.

Map: These filters aim to manipulate the image by treating it like a piece of paper that can be folded in various ways and also stuck onto 3D shapes (a process referred to as mapping). Because the image is treated as if it were a piece of paper, it can also be copied, and the copies placed on top of each other to create various effects.

Render: Here, you’ll find filters designed to create new images from scratch, such as clouds or flame effects. They obliterate anything that was previously underneath on that particular layer or within that selection, and the original image has no bearing on what is generated by the filter.

Web: Here, you can create an image map for use in a web page. An image map is a single image broken up into separate hyperlinked areas, typically used on a web page as a sophisticated menu. For example, an image map is frequently used for a geographical map on which you can click to get more information about different regions.

Animation: These filters aim to manipulate and optimize GIF images, which are commonly used to create simple animated images for use on web sites.

Combine: Here, you’ll find filters that combine two or more images into one.

Toys: These are so-called “Easter Eggs,” which aren’t designed to manipulate the image, but are present in the program as harmless animations for the user to enjoy. They’re created by the programmers of The GIMP as a way of thanking you for using their program.

Tip The GIMP also includes Script-Fu and Python-Fu, scripting languages that can be used to daisy-chain several commands together to produce a particular effect or to automate a particular image-editing process. For more information, search for “script-fu” or “python-fu” using your favorite web search engine.

._

No comments:

Post a Comment