Posts tagged ubuntu

Creating Camera Ready Artwork Using the Gimp

I’m creating some business cards and my print shop needs PDF format output with a CMYK colour profile. Neither of these can be done with the Gimp as installed, so this is what I had to do in Ubuntu Oneiric Ocelot with Gimp 2.6.11 to finish the task:

1) install gimp-plugin-registry and icc-profiles from the apt repository (“sudo apt-get install gimp-plugin-registry icc-profiles” or use the software centre);
2) open the image I want to send to the print shop and select “Image/Flatten Image” (if the image has multiple layers) and then “Image/Separate/Separate”;
3) in the dialog, accept the default options, but optionally check “Make CMYK pseudo-composite” (this doesn’t seem to affect the final product, but it does generate an image with the colour layers blended in a way that is recognizable — that way you can see that you are getting what you expect);
4) when the new separated version of the image pops up in a new window, select “Image/Separate/Export…” and save as a TIF file;
5) use “tiff2pdf filename.tif -o filename.pdf” to create the pdf file for the printer.

The most useful info I found on this topic was here: and

Reinstalling A Corrupted Ubuntu Karmic Upgrade

I have previously posted about my own Karmic upgrade problems. In my case, the system crashed in the middle of the upgrade (due to my own fault, nothing to do with the upgrade itself as far as I know), causing my half-upgraded system to be unable to mount the root filesystem and dropping me into a maintenance shell.

I’ve always tried to promote Linux use among friends and family which means I also provide support as required. Yesterday, a friend of mine brought me her laptop with a similar problem to the one I had: in her case, she thinks that she lost her internet connection in the middle of the Jaunty to Karmic upgrade. In any case, her half-upgraded system would neither boot nor allow a root prompt. The error message on the console was:

mountall: symbol lookup error: mountall: undefined symbol: udev_monitor_filter_add_match_subsystem_devtype
init: mountall main process (310) terminated with status 127

I tried a couple of things: first, I used an old Jaunty disk to boot the machine, mounted the old root filesystem and attempted to use chroot so that I could complete the upgrade.

mkdir /media/disk
mount /dev/sda5 /media/disk
chroot /media/disk

Unfortunately, this didn’t work because I had no network devices available in the chroot jail, and I couldn’t find any obvious way to sort that out. Similarly, I downloaded a new iso of Ubuntu Karmic hoping to use it as the apt source for the upgrade, but I couldn’t access the cd drive either, even using apt-cdrom to set it up. As before, a bit more effort might have sorted this out, but I decided to solve the problem by doing a complete re-install of Karmic over top of the previous one.

I backed up the /etc and /home directories to an external hard drive first to be safe. To my delight, the reinstall worked fine and didn’t clobber any of the existing user data on the drive. During the partioning step, I selected the manual option. I changed /dev/sda5 (which in this case was the old Ubuntu root filesystem) to mount as “/” but didn’t check the box for it to be formatted. In the “import settings” step, I also told the installer to import user settings from the old Ubuntu install. When I rebooted, everything was up to date, and the user settings and documents were all in place as expected. Good to know!

As a final note, I should add that when I set up this system for my friend, I configured Dropbox and told her how to use it. That meant that I could’ve easily restored everything even if I’d had to do a complete format and reinstall. On my own machine, I’ve placed a symbolic link to /etc in my Dropbox folder (it doesn’t take up much space) along with linked versions of all of my important dot files — that means that, with a little effort, I can reimage and restore at any time. I will set up all my friends the same way from now on.

Logging out with the Cairo dock

I’ve decided to take advantage of my new powerful laptop and enable a little eye candy. I’ve tweaked Compiz to my liking and enabled the Cairo dock (I used the Avant Window Navigator for a couple of days and liked it as well, but Cairo is even better). I’ve been able to set up my Cairo dock to give me everything I appreciated in the old gnome panels with one exception: the user switcher applet. Cairo gives you a shut-down menu, but no way to log out of your session or switch to another user.

I have discovered the command “gdmXnestchooser” which at least lets me switch to the face browser and log in as another user, but I’d like to be able to log out of my current session sometimes in order to refresh things. I have also enabled restarting the X server (similar results to logging out) as described here. Essentially, you must go to the preferences/keyboard/layout and enable the ctrl-alt-backspace key combination. Another tool, “gdmXnestchooser” allows you to create a nested X session, but you need to install gdm-2.20 to make it work and I don’t want to risk buggering up my current setup.

One thing I love about the combination of Compiz and Cairo is the ability to dump all of my widgets (weather, clock, conky, system tray etc.) onto the compiz widget layer. I have it configured to pop up when I move the mouse to the top edge of the screen so I can instantly see the status of everything without having to use precious screen real estate or flip back to the desktop. I have the dock on auto-hide, so I can use the full screen without sacrificing usability. It is an elegant solution to the problem of trying to use a single display for many simultaneous purposes.

UPDATE: Turns out it’s easy to log out from the Cairo dock…see comment below.

Ubuntu Karmic Koala Upgrade

I have upgraded from Jaunty to Karmic on my Dell XPS 1610 and everything seems to work great.

My upgrade was interrupted (my own fault for running another application at the same time and having it crash) and caused some serious problems for a few hours while I tried to fix it. The symptom was that the system wouldn’t boot and told me that it couldn’t read from the root filesystem. In the end I solved the problem by dropping to a shell, re-mounting the root disk so I could write to it (“mount -o remount,rw /”), then running apt-get and sorting out dependency problems with python2.6 and mono-common (I finally had to delete /var/lib/binfmts/python2.5 in order for python to install properly). This process took hours and finally I was able to perform a full “apt-get dist-upgrade” from the shell, then reboot. I still had a disk error which prevented booting, but I discovered a great tip someplace to force a disk check on the root filesystem on reboot with “tune2fs -C 30 /dev/sda5″ (or whatever device).

The experience reminded me that Linux is great for people like me, but maybe not so great for others. It isn’t that Windows doesn’t have similar problems (like I said, it was my fault for crashing the system in the middle of a major upgrade), but when it does, a less-savvy user can take the machine to the corner computer shop to get it fixed.

In spite of that, Karmic has lots of great features that make it perfect for any user. I’m still noticing small changes, but so far, so good. I like the new face browser login window and I’m thrilled with the new audio control panel, which is simpler and clearer than before with new features — for example, you can now see which active applications are using the sound server and turn them on and off with a single click.

Cinelerra Audio Sync Problem on Ubuntu Jaunty

Everytime I try to set up Cinelerra on a new project or on a new system configuration, it takes a while to get everything working well. In my case, I have several new variables to contend with: I’m starting with HDV footage from a new camera, I have a new machine, I’m using a new version of Ubuntu and of Cinelerra.

This time around, I’ve had trouble with audio sync during playback. The symptom is that when I play a dv clip (which is fine on its own in VLC) in the Compositor Window in Cinelerra, I get a 10 second audio time lag which seems impossible to correct by nudging or setting the audio offset value.

Fortunately, this doesn’t seem to affect rendering, but it still makes it tough to edit properly. After a great deal of fiddling, I finally discovered (via a note here) that I could use the Pulseaudio sound driver in Ubuntu (select “Esound” and port 7007 in the Cinelerra Playback settings) instead of ALSA. Suddenly, my project sounded much better. The audio track was still out slightly, but I used the technique described in Secrets of Cinelerra to sync the sound using the nudge value of the audio tracks. There is additional helpful info on audio syncing here.

I was surprised that this simple matter took so much searching to solve. Here’s hoping that this post will pop up in future searches.

To summarize, if you are running Cinelerra on Ubuntu and have audio sync problems, try switching your audio driver to “esound” on port 7007 and you may be pleasantly surprised.

UPDATE: This is very weird, but the above config works fine when I run Cinelerra as a user, but NOT when I run it as root! Obviously, I’ve got the PulseAudio settings messed up somewhere, but at least it works.

Hauppauge WinTV-HVR 950Q USB TV Tuner

I purchased a USB TV tuner device hoping to be able to do two things: a) receive (and possibly record) analog NTSC TV broadcasts, and b) accept analog input from a VCR to digitize some old VHS media.

After a lot of red herrings and attempts to install drivers, I finally understood that the device had been detected in Ubuntu Jaunty without any extra effort. Configuring the device was a little more complicated, however. I installed the following packages to help diagnose whether the device was working: dvb-apps, dvb-utils, w-scan. Unfortunately, I’ve discovered that apparently Video4Linux doesn’t support receiving analog signals with this device (my fault for not doing more research, I guess). We don’t have digital signals where I live (and I don’t have digital cable or any other usable sources available).

Potentially helpful info here and here.

Plan B: try to get the device running under Windows XP in VirtualBox.

Installing VirtualBox to Run Windows XP Home Edition on Ubuntu Jaunty

VirtualBox allows you to run a nested operating system on top of Linux. I want to use it with Windows XP (which I have an old copy of) in order to run the imaging software which came with my new Epson Perfection V500 Photo scanner. It may also come in handy if I want to run some of my favourite old games like Age of Empires and Starcraft. The difference between VirtualBox and dual-booted operating systems is that the nested (or guest) OS will be running at the same time as my regular Ubuntu applications — no reboot required. I’m keen to see how it goes.

In Ubuntu Jaunty, the installation was a snap. I followed the instructions in the VirtualBox manual:

First I installed virtualbox with apt-get (you could use aptitude or synaptic, of course), then I added myself to the appropriate group:

sudo usermod -a -G vboxusers kevin

That was it for the initial installation. Next I had to set up the Windows XP virtual machine. After getting a “session3_initialization_failed” blue screen error the first couple of times I tried to install Windows XP Home, I found the instructions here. In particular, the post suggests adding this line

none /proc/bus/usb usbfs devgid=000,devmode=664 0 0

to /etc/fstab where “000″ is replaced by the group id for vboxusers which you can obtain from the /etc/group file. Note that the original post suggests this technique for Ubuntu Intrepid, but it also worked for my Ubuntu Jaunty install.

I now have Windows XP Home Edition running perfectly inside my Ubuntu system.

UPDATE: Turns out to be slightly more complicated than I thought. The virtualbox-ose (open source edition) packages work great unless you want USB support. For that you have to re-install using the virtualbox-3.0 non-free packages available from Sun. I simply added Sun’s repository, installed the other version and everything worked fine from there.

Scanning via USB from a Brother MFC-8500C

I’m still working on digitizing all my old media, including paper. I have an old Brother laser multi-function with an automatic document feeder that I’ve only ever used as a printer and fax. I tried to set it up for scanning years ago, but had no success. Times have changed and I had no problem getting it working this time around so I can scan all my old paper files.

Scanning only works for the root user at the moment, but I don’t care. Discussion here.

Step 1. Download and install the linux drivers which are now available from Brother here. The instructions provided worked flawlessly on Ubuntu Jaunty.

Step 2. As root, Install the sane-utils and libtiff-tools packages.

sudo apt-get install sane-utils libtiff-tools

Step 3. Scan. XSane worked fine for basic scans, but I want to be able to do double-sided scanning on a simplex scanner, so I decided to use the command line for this. There are other tools available if you prefer a gui.

To scan letter-size single sided:

scanimage -y 279 –format=tiff –batch –progress

The “-y 279″ is the page length in mm — without it, scanimage seemed to create legal size scans by default. To scan a pile of pages on both sides, start with side one:

scanimage -y 279 –format=tiff –batch –progress –batch-double

Then, flip over the pile and substitute the last page number (which the previous command will tell you) minus one for “[last page - 1]” below:

scanimage -y 279 –format=tiff –batch –batch-double –progress –batch-increment=-2 –batch-start [last page - 1]

Finally, put the whole thing together in one big tiff and convert to pdf:

tiffcp out*.tif out_all.tif;tiff2pdf out_all.tif -o filename.pdf;rm -f out*.tif

The final rm is added to the previous command so that you can continue scanning jobs without either getting your tiff files mixed up or inadvertently trying to include a finished multipage tiff in the next pdf conversion.

I have written a script which prompts the user for single or double-sided printing and an output filename, then scans and converts documents:

#kk a script to scan a batch of pages on both sides, then combine and convert them to pdf

DATESTAMP=$(date ‘+%Y%m%d%H%M%S’)

#clean up
rm -f $WORKDIR/out*

#prompt for single or double-sided scanning
read -n 1 -p “How many sides ([1]/2)? ” SIDES
if [ "$SIDES" == "2" ]

#scan the first sides
#the end of this command sends progress output to both stdout and to a file
scanimage –format=tiff –batch=”$WORKDIR/out%d.tif” –progress –batch-double -y 279 3>&1 >&2 2>&3 3>&- | tee $WORKDIR/out_count.txt

#figure out what page to start the flip side scan on
LASTPAGE=`grep “Scanning page ” $WORKDIR/out_count.txt | tail -n 1 | sed ‘s/Scanning page //g’`
BATCHSTART=`echo $LASTPAGE – 1 | bc -l`

#give user a chance to flip and refeed the pages
read -n 1 -p “Flip over the pages (counting down from $BATCHSTART) and press any key to continue…”

#scan the second sides
scanimage –format=tiff –batch=”$WORKDIR/out%d.tif” –progress –batch-increment=-2 –batch-start $BATCHSTART -y 279


#scan the pages
scanimage –format=tiff –batch=”$WORKDIR/out%d.tif” –progress -y 279


#combine all the tiff files into one document
tiffcp $WORKDIR/out*.tif $WORKDIR/out_all.tif

#prompt for a filename
read -p “What should I name the document (extension will be added automatically)? ” NAMER
if [ "$NAMER" == "" ]

#convert to pdf
tiff2pdf $WORKDIR/out_all.tif -o $OUTPUTDIR/$NAMER.pdf

The script is pretty basic, but should be easily adaptable for your own purposes. You can save it as, make it executable, and run it with “./”

And the Winner Is: digikam

I’ve decided to proceed using the KDE application digikam. It seems to do everything I want (plus lots more) and is open source and easy to use. It looks like it integrates with various web services, including facebook and flickr, without difficulty. The only disadvantage I can find is that the image editor doesn’t automatically save new versions non-destructively. I think I can live with that.

F-Spot looks like a good basic photo manager, but it lacks some of the advanced features of digiKam and Picasa and my web research seems to suggest that it chokes on large collections of files.

Picasa looks great and includes all the features I expect I could want. Unfortunately, it isn’t open source and that is a deal-breaker for me.

I’m going to give digikam a try for a while and report back what I find out.

Managing Photos

We have too many photographs! I’d like to get them under control so that we can enjoy them now and preserve them for the future.

We have a dozen albums and a couple of big boxes of old negatives and prints, including some that I developed myself and a few old family photographs that go back to the 1940s. We’ve been taking digital photos for nearly a decade and my photo directory holds over 12,000 items already. On top of all of this, I also have hours and hours of digital video which I’d like to eventually fold into the same management scheme as the rest.

In order to get these in order, I would like to digitize everything. Eventually, I’ll buy or use a scanner for negatives and prints. In the meantime, I want to organize the photos that are already in digital form. That means using a photo manager. I’ve done a little research and there appear to be several options worth considering.

Right now I store everything in a carefully-designed folder hierarchy. All the image files are in folders by batch — each group I upload from a camera is placed in raw form in a folder named by the date I uploaded and a tag for subject matter when the pictures are all similar (e.g. 2007-01-13_kevin_birthday). I avoid spaces in the names and always use YYYY-MM-DD for the date format to ensure that the folders sort correctly. This works well to organize and store the photos, but it isn’t easy to browse or manipulate them. When I want a cropped or renamed version of an image, I save it under a new name and new location to ensure that the raw images are preserved. Over the years, I’ve ended up with some duplicate image folders which I’d like to purge, but I need some tools to help do so. I group the image folders in higher level folders by year (YYYY). This way I can archive each year and back it up without having to worry that the folder contents will ever change. This method meets my basic needs, but I really want something that will allow me to add metadata, manage versions of each image as required, and browse easily.

In fact, what I want is a system very much like what rhythmbox and other tools give me for managing my audio collection. I’d like to keep my directory system for raw photos, store tag data inside the image files themselves, and use a front-end application to browse images using the metadata. I don’t want to be locked into anything so that I can change front-end application at any time in the future. It would also be great to be able to sync some or all of my photo collection with a data store on the web such as flickr, picasa, or other. Oh, and I should be able to do non-destructive editing of the images using the Gimp (or at least in a way that is compatible with the Gimp).

What else do I want? It would be nice to have simple one-click options to correct basic image errors like red-eye and bad contrast. The application should be open source unless I have no other choice.

The options I’ve discovered so far include the default f-spot photo manager which is installed with Ubuntu, the KDE application digicam, and Google’s picasa. There are certainly others out there, but these three seem to be the most popular and robust. I will try them out and report back.