Sep 072009

Hello, and welcome to this, the final part of my tutorial series on doing photoediting with GNU/Linux and free software. I say final because after this, we’re getting into the professional arena for which good books are a much better option than blogposts. What I will be covering in this is some basic photographic handling skills and how to do them in the gimp. I won’t be using channels or layers in this tutorial but everything in here remains applicacable when you use them.

A common problem for a photographer when you shoot outside a studio, is that your light and color and backgrounds are not ideal, so we’ll learn how to do some basic corrections, and how to highlight our subject against a cluttered background. Here is a picture I took at the 7thson gig, it was near the end of the show and to get it, I had to use a very high ISO level as the light was fading and I wasn’t using a flash. The price I paid was digital noise – and the background is rather cluttered.
Here you see the image, in UFRaw, with our first bit of highlighting already busy: we’re cropping out some of the wasted stuff.

I’ve not done much else in RAW on this one as the shot was really rather good, I only raised the exposure level very slightly.

Clicking on OK gives us the image in GIMP:

Our first problem is the digital noise that came from using a high ISO level, Gimp has a built-in tool to help correct this, called Despeckle (Filters|Enhance|Despeckle). UFraw also has such a tool but it offers far less control, despeckling costs you detail so you want to aim for an optimum balance to lose as little as possible and maintain a usable picture (if perhaps not a print-quality one).

This gives us a much better picture already. Now we can reduce some of the effects of despeckling by going for a softer-focussed image, for this we use one of GIMP’s most useful tools, the Gausian Blur, with a smallish radius, it just softens the focus enough to smooth out the picture without losing so much detail as to harm it – in fact, it makes it prettier.

Now we want to deal with the background, ripping it out is possible but will cost us all context, instead we just want to remove it’s eye-pulling effect while maintaining it’s presence, so it provides atmosphere rather than interference. I started by removing the drummer’s half visible head (as it contributed nothing) using the clone tool (I cover this in detail below), now for the fun part though – selecting the background outside the guitarist. Gimp offers an easy way to select complex shapes using the Path tool by clicking along the contours you can gradually select out your target.

Now we use Select|From Path to turn our path into a selection. You can also use the lasso tool for this, but only if you have a very steady hand. We will begin by reducing the coloring of the background making it effectively a semi-black-and-white image, thus reducing it’s distracting effect a great deal and making it nice for atmosphere. First we need to adjust our selection a little, we start by shrinking it until it is just inside the border of the guitarist (Select|Shrink Selection) – so we’ll have a smooth transition, then to smooth things further, we feather it (Select Feather) by about 5 pixels.

We invert the selection to select the background around the guitarist rather than the guitarist himself, we open the Hue/Saturation tool from the colors menu.  and drop the saturation a good deal – this gradually reduces the coloring of the background, until we get a near black-and-white effect with just enough color to still look nice.

Below, you can see the results, already an improvement, but there’s a catch – look at the guitar cable, it’s now much brighter on the player’s leg, and thus causes a problem, luckilly the way it runs, if we remove it, it will just appear that it ran behind him – so we have an easy answer, just get rid of it.

For this we use gimp’s clone tool. Cloning lets us take one part of the image and paint over another with it, it’s a powerful tool but at it’s most basic, using a feather-edged brush of about 35-pixel diameter and the aligned mode, it lets us quickly paint out the cable using the surrounding denim.

Now all we do is another small gausian blur to remove the edges from the changes we made, and here we have our final result, it’s pretty, it’s got atmosphere and we’ve turned a bad-luck shot into a work of art.

Aug 282009

As I left after my vacation, fully intent to pursue photography all out, my dad gave me some copies of programs he uses day to day (as one who works primarily on Windows). One of which is called “RescuePro” – a program Sandisk makes freely available (as in beer) with their SD cards (though many shops neglect to include the CD’s).

The purpose of this program was, he said, to be able to recover files deleted from your SD card either by accident or because of a software bug. I hadn’t had the opportunity to look into this issue and since my new camera is not yet acquired and I was just working with pix already on my hard-drive, I haven’t had a need yet. As it turns out, fortune smiled on me and in my RSS feeds this morning was a blogpost shared by Karl Fischer covering a GNU/Linux tool for the same purpose.

It seems this is a frequent need for photographers so it’s as well to be prepared and good to know that as a GNU/Linux using photographer you don’t have to miss out on anything. I know I promised a post on touch-ups but that will take some time still, in the meantime – this was a piece of evidently appropriate information that I felt deserved a post in this series.

So I would highly recommend ensuring that you have PhotoRec installed on your machine as part of setting up your digital darkroom. The post in question (which also runs through it’s use very nicely) and has all the required information is here.

Aug 262009

So, yesterday we looked at tools for manipulating and reading the RAW format images that photographers so often use. I want to start with a small update to that, Johan has let me know of another gimp plugin called gimp-dcraw which opens the RAW files directly in gimp eliminating the intermediary step you find with UFRaw. Now I am not at all sure whether I think that’s a good or a bad thing, since Gimp won’t offer the RAW modification tools you want but it may be better for some people’s workflows so I thought I should at least mention it.

Now on to today’s lesson. Last night saw me having to start the process of organizing pictures, deciding what to delete, what are “keepers” already, what needs RAW work, what should be going for touch-ups etc.the workflow I propose here is what I came up with, it may not be something you like but the generic skills in it should be usable by all.

Digikam defaults to keeping your main local store in your home directory under a subdirectory called Pictures. Within which each directory becomes and album automatically, and subdirectories form subalbums. This is actually a nice way because it means you can quite easily construct a sensible album structure from an existing folder structure.

I began by creating three new top-level albums inside this folder called “RAW”, “WEB” and “TIFF”. Raw as you can guess is for keeping the RAW imported albums as they come in from cameras. TIFF is where post-raw compressed pictures will be kept for the future, and WEB is for dumping web-exports like png or jpg.

Over time they will have almost identical subalbum structures but with radically different content, and of course, as I finish processing an album under RAW, the RAW copy will be deleted.

Currently my photo-management tasks were centered around the pictures I took in the Kruger Park recently. I took well over 500 pictures, of which most are really bad (with nature photography being as hard as it is, you get a lot of wastage). So I needed to make sense of this whole lot of pictures, get rid of the really bad ones and find a sensible way to work through what’s left for post-processing.

Digikam handled this very well. I started with tagging, renaming files to represent their content really isn’t ideal for images – for starters it would take forever, a nicely thought out tagging structure makes it so much easier to find things later. So I started by opening the KNP album, and selecting all, then I applied a new “krugerpark” tag. Digikam allows tag hierarchies, so I then started going through the list, looking at the thumbnails and selecting a bunch at a time, tagging each set of pictures appropriately.This gave me for example a set of pictures tagged: krugerpark/birds/fisheagle for example. The ability to multi-select and tag and easily select prior parts of the hierarchy was really handy and I had everything done within about an hour’s time.

Thus with the content tagging done, the next phase came. Now I cycled them in large-preview mode, one by one. I would study each picture and make an initial assessment. The ones I were simply unhappy with I tagged with “delete”. Those I could see needed some touch-ups I tagged with “touchup” and the rare few ones I consider my best shots were tagged with “keeper”. Of course some were tagged with both touch-up and keeper (meaning I think it’s a good picture but it needs a little something such as cropping). This was a much slower process as I was working one-by-one through a huge set of pictures, but still I was done in about 2 hours and I have no doubt without digikam’s brilliant interface it would have taken a lot longer.

Thus done, I went to the main menu and chose: Tools|Advanced search. I then search for pictures where a tag contains “delete”, did a select-all on the results and chose “Move to trash” from the right-click menu.  In all, well over 300 pictures didn’t make the cut, leaving me with just over 200 to go. Some of those will no-doubt be deleted over the next few days, many will get touched up. Often when there were several good shots I couldn’t yet decide which was best and will be deciding this only after touch-ups are done.

Ultimately then, I will end up with a slightly smaller subset of the above that is touched-up and ready. My approach now will be I think to start going through them one-by-one again. Open with gimp, then do my raw-editing and touchups, and save the result into the KNP album under TIFF. What doesn’t make the cut here won’t even go there.

Once everything is through that process, delete the entire KNP album under RAW and get that space recovered. Though I won’t be able to do further RAW work on the TIFF’s – future touch-ups will be possible, and of course they will be very high-resolution and quality. My plan there-after is to go through and select the ones I want to publish to the website album, and the “best-of-each” that will make up the big Kruger Park photo-blog. Again I plan to use tagging, some will be tagged “web”, some of those will be tagged “blog”.

Then a simple search will once more let me select out everything with “web” tags, and batch convert them to png which will be in a KNP sub-album under WEB. All seems quite sensible to me – and I think I like this. Even if your preferred layout is different I think the approach to tag and then work will save time and help you to manage the photos effectively and easily.

Finally – the content of the web subalbum will be uploaded to a gallery on the site, and the ones with the blog tag will be filtered into the nice big post (with, of course, a link to the complete album included).

While this post did not cover all the features of digikam (there are many, many of them) it did cover the core piece of it’s functionality, managing, finding and organizing your photos, the rest really are – in my view, add-ons.

I expect it will take a few days before part 3 is published as that will be about touch-ups – something I myself am still learning, in the meantime though, I would like to offer as a reading list the book I intend to use myself for this part. Check out the following:

Gimp 2 for Photographers – Image editing with Open Source Software

Also, check out the list of books on Gimp’s own site.

A nice overview of the basics is to be found in this blogpost (and there are many others covering various things if you don’t have the budget for a set of books).

At this stage I would like ask for a bit of additional feedback on another topic. Which other GNU/Linux friendly tools than gimp have you used for photo-editing and what did you find to be the best and worst about them (this list does not need to be limited to free software only, as I’m firstly trying to get an overview). I’m particularly interested in your experiences with krita, picassa and picnic but please mention others I may not know about.

Aug 252009

As part of my forays into digital photography on a professional level – I will be trying to replicate to the highest possible degree (and exceeding where possible) the tools and equipment used by our non-free software using friends in the windows and mac worlds, particularly photoshop and it’s associated tools.

Now to do this, I will be evaluating a number of tools and seeing how they fit in as replacements. I will blog the results and the methods I use and this will lead to hopefully a series of good howtos for the beginner photographer using GNU/Linux and free software. Since I’m a beginner myself and this is a learn-as-I-need-things series it will be on  a lower level than most tutorials out there, and will also act as my own reference documentation in the future.

With this intro out of the way – let us start part one, working with RAW format images.

Now first of all the question should be answered: what is a raw image and why use it ? After all, almost every digital camera shoots in jpeg format by default right ? This is true, but real photographers override this with good reason. RAW means the image gets dumped as it’s read by the camera’s censor with the maximum amount of data stored. JPEG is in fact just about the worst format for storing images in anyway as it’s a lossy-compression. You will want to save your web-published pictures into jpeg, but you will not want to work with it yourself or store your own copies this way. RAW images are also refered to as a “digital negative” as they afford you a lot of the power that film photographers had working on negatives… and then some.

But there is a catch – there is no standard on how RAW images are stored, each camera brand uses it’s own format and sometimes it even changes between models. The good news is that for GNU/Linux users there is a very good library that can read and manipulate RAW images known as libdcraw (for DigitalCamera RAW), all the tools we use for RAW work are based on dcraw. DCRaw supports a massive selection of camera formats and virtually every common one including those used by Nikon and and Canon are fully supported. DCRaw is included in most distributions, and since it’s a dependency of the other tools here, should be installed automatically if you have it.

Now the first issue with RAW images is viewing them, and viewing them in bulk. Opening them one-by-one is not a good way to go through a set and decide which to keep, before starting to edit. The good news is that the current version of digikam includes full support for dcraw and can view them easily as can KDE4’s showphoto (which is a one-by-one tool integrated with digikam as well). Digikam makes a very solid replacement for photoshop’s “bridge” program and includes a massive amount of extra features of which I haven’t explored the half.

Where it falls a bit short is the manipulation of RAW data. Adjusting light levels and such – it includes a tool to do this, as well as a batch RAW-converter (so when you’re done editing you can rapidly export say web-jpegs of all the final results) but the manipulation tools was a bit… well clunky for me. Not knowing exactly the details of all the options you can do on RAW files, I need something that lets me play quite easily with it. It is also not integrated into an image editor which makes the next stage hard – now you need to edit the RAW file, then save it as something else (like TIFF) before you can use most image editors to work on the image itself.

Well, gimp is obviously the tool of choice for image editing. It’s powerful and feature-rich and while it doesn’t work like photoshop – it can do the vast majority of what photoshop can (I am quite certain it can do everything the beginner photographer will need for some time). I suggest reading a good gimp tutorial to learn it if you don’t know it (the good news is, I do know it quite well since I’ve been using it for things like logo designs for years). Even so I will be brushing up with some new tutorials to sharpen up my skills. I just learned today for example (thanks to a blogpost that showed up in my RSS reader) that gimp can read and use photoshop brushes.

But, here’s the catch: gimp doesn’t natively support libdcraw and thus cannot work with raw images. Free software to the rescue, I found a lovely gimp plugin called UFraw which handles this in much the same way photoshop does. Opening a raw image first loads it into the UFRaw interface which is just like it’s photoshop cousin (UFRaw also has a stand-alone version) – I will be adding a port for it to kongoni today but I don’t know how well it’s take-up in other distro’s are, it’s quite easy to build if you follow the instructions on the site though.

It actually supersedes most other raw tools because it uses the single-library nature of libdcraw to gain some real power. For example it can create and use nikon curves on images taken with non-nikon cameras (whatever that means…).

So  once you install it, you open a raw file in gimp and bang – here’s your raw manipulator. You do whatever adjustments you want, and click Okay… and it then exports this as pure bitmap data and you get a normal gimp window where you can proceed with your touch-up work, and save the final result in whatever format you wish.

A note on that last point. The advice from books and other photographers agree: for your own copies, once you are done with the raw, save as TIFF format. If you want to save some disk-space, use the loss-less LZW compression (which is free software by the way). This means you can always come back later and work on the touch-up level, you have a high-quality image for exporting for print or other purposes etcetera and it takes a lot less space than the RAW files do.

While jpg continues to rule the web – I prefer to export my web images in png format, it’s more powerful far less lossy (for similar compression ratios) and not encumbered by patents.

Thus we have now set up the first part of our digital darkroom, we can browse and manipulate the raw images from our cameras, and get them to a touch-up ready point. As I learn some tricks of the trade about touch-ups, I will be sharing this in part two.

Jun 172009

Now as you know, I don’t like non-free software, and I make a great effort to keep all my machines free of the stuff. Unfortunately, I also have a dayjob and I don’t get to decide software purchase policy so I’m required to have windows available to run a few windows applications.
Oh well – until such time as me and my fellow voices of reason in the company have won, I’ve got virtualbox on my work laptop with a windows vm for running said few apps. When I first set it up, I gave it a 10gb virtual hard drive, unfortunately, it has lately gotten to the point where it is just not enough. The machine is basically data-less but the apps on it take up a lot of space.
I had to make it bigger, and I did not want to have to spend hours reinstalling it. GNU/Linux to the rescue :) I used kongoni for this because it’s easy to work with and has everything I need for this already easily available but quite a lot of other live systems would work just as well as long as at least parted is available (I prefer to work with gparted but it’s hardly a requirement). I did this on a virtual machine, but the exact same approach should work just as well on real machines.

Okay, so the first step was to create a new hard drive for the windows VM, doubling it’s size to 20Gb which should be more than enough to handle my needs, and connect it as the primary slave. I then added my kongoni ISO as the CD-rom drive and booted it up into the LIVE cd.

I chose not to start the graphical environment at this stage, and did a root login on the console instead. A quick check to verify that I had the drive names right:
fdisk -l /dev/hda
fdisk -l /dev/hdb

Confirmed that hda had a 10gb partition on it (hda1) and hdb had no partitions.
Right then, next command was to clone the existing drive with partition table and all onto the new drive:
dd if=/dev/hda of=/dev/hdb

When it finished, another fdisk now showed identical partition layouts on both drives. I then shut down the VM and swapped the virtual drives around so that the 20gb became the primary master, and booted it up to verify that indeed it worked just fine.

Rebooted off the CD again, fired up gparted and resized partition the new drive (now named hda of course) to the full 20gb available space.
When it finished, I booted windows again, it did a disk-check and then let me in – all good.
Finally, I shut down the VM and removed the old 10gb drive, reclaiming that space for my real operating system.

The whole process took a long time (unfortunately both cloning partitions and resizing filesystems are slow processes) but it worked beautifully.