In Praise of Perl

Mascot of the Perl Programming Language

By Gene Wilburn

Programming languages rise and fall in popularity. For awhile everyone is keen on C, then C++, followed by languages such as Golang, Rust, Haskell, Python, or [fill in the blank with your favourite language]. Their popularity is frequently driven by need — the desire to find the best tools for highly complex programming projects.

Some languages fall by the wayside. Few programmers still use Algol, Fortran, COBOL, Basic, or Pascal. Though they were widely used in their day, they now appear mainly in legacy programs.

And some languages, while no longer as widely used, still persist among those who appreciate their special qualities. These include Common Lisp and, my favourite, Perl.

What is Perl?

Perl is an interpreted general purpose language similar in some ways to Python. It began life as scripting language, which it still excels at. It doesn’t force any particular programming paradigm on the developer and is well known for its motto: “There’s more than one way to do it.”

Created by Larry Wall in 1987, Perl has, from the start, been used for system scripting and text handling. With a C-like syntax, it combined elements of sed, awk, and shell scripting. It has become known for its extensive and elegant support of regular expressions, also called “regex” and “re”.

Its many built-in structures, such as support for arrays and “associative arrays” (similar to Python “dictionaries”), is augmented by a very large selection of libraries or modules (PerlMods) that can be used for specialized applications, such as reading and traversing hierarchical data structures such as XML or json files. There are thousands of specialized modules available at CPAN, the Comprehensive Perl Archive Network.

Of course Perl supports all widely used database products such as MySQL and Postgres, and in the early days of web development, many interactive websites were developed in PerlCGI.

Practical Programming

Not all programs are big, though. Little programs, too, have their place. Perl is ideal for crafting utilities that you can use at the command line, often as filter programs that take “standard in” (stdin) data, do something with the content, then pipe it out to “standard out” (stdout).

Example of setting up a filter program

while (my $line = <>) {
# Do something to the line from stdin if warranted
# then send the line back out to stdout with
print "$line\n";

There. That’s the skeleton for a Perl filter program. All you need to do is fill in the task(s) you want done on the line. (It can get more elaborate, certainly, but that’s true of all languages.)

Suppose you frequently write reports, articles, blog entries, or daily entries in a journal and that, being text oriented, use Markdown notation to mark how text should be formatted for display. Along the way you may have used two hyphens to indicate an em-dash (—).

Then you learn that Pandoc, which is widely used to convert Markdown to other formats, follows the TeX typesetting convention of using three hyphens to indicate an em-dash and two hyphens to indicate an en-dash, the shorter than em-dash, longer than hyphen dash that separates number ranges in academic and formal typesetting, e.g., Pages 2–5. How do you easily fix your documents so that Pandoc assigns em-dashes where you intended them?

You could open each document and do a find-and-replace operation. That’s okay for a few documents but suppose you needed a way to check this in multiple documents on a regular basis? Enter a few commands in the Perl script, using Perl’s regular expressions. You can, at the same time, also remove any blank spaces before and after the hyphens, putting the resulting dashes tight against the words — also standard for traditional typesetting. (Why do this? It makes the document look better, especially when the lines of output are justified, as in a report, printed book, or PDF.)

Example of using regexes in a filter program

All we need to do in Perl is inject some if logic and some regular expressions:

# Remove any spaces around " - " or " -- "
$line =~ s/\-\- /\-\-/g;
$line =~ s/ \-\-/\-\-/g;

# Test for " -- " and expand to " --- "
if ($line =~ m/\-\-/ and $line !~ m/\-\-\-/)
$line =~ s/\-\-/\-\-\-/g;

Note: I had to insert backslash escape characters in this snippet because Medium screws up the formatting otherwise.

Then you can use your filter program, let’s call it, at the command line using pipes and redirection:

$ cat <filename> | > <newfilename>

For a routine job you could then call this filter program in a shell script. Here’s an actual example I use to annually groom my monthly journal Markdown text files into Pandoc-ready versions, before turning my journals into an annual ebook:


# Wrapper for

for i in *.md
bname=$(basename "$i" | cut -d. -f1)
echo $bname # Display which file is being checked < $i > ./$bname.mmd

Converting the entire year’s journal entries with this script takes maybe 2 seconds. You’ll notice that I convert all my files that have the suffix .md and write out files with the same basenane but with an .mmd suffix. This preserves the original file in case something goes wrong. After a positive review, I then delete all the .md files with:

$ rm *.md

These examples were meant simply to give you a slight introduction to Perl, in case it catches your fancy. Perl is open source and free. It is packaged with any *nix-based operating system, including Linux, FreeBSD, and MacOS.

For an in-depth look at the language visit The most popular book on Perl is the “Camel Book”, Programming Perl, an O’Reilly book by Larry Wall and contributors.

Happy Perling!

Gene Wilburn is a retired Canadian IT specialist, writer, photographer, and occasional folksinger. He is the author of Markdown for Writers, 2nd Ed., Rev.

Back to Bash

How to Make MacOS More Linux-like

Up-to-date Bash shell in MacOS

One of the great things about MacOS is its command line, a terminal onto a Unix-derived set of utilities that are available for free. All you have to do is issue the following command in a Mac’s Terminal application to get a full set of them.

% xcode-select —install

Apple’s official name for these is Xcode Command Line Tools. If you’re used to a Unix-style command line, you’ll feel right at home. Well, almost.

If you come from a Linux background, you will find the tools a bit … lacking. The problem is that many of them are out of date. Apple doesn’t put a high priority on keeping them current. Another problem is that many of the utilities are derived from BSD rather than GPL Linux repositories, which means that they’re not as feature rich as their Linux counterparts.

For years, Apple made Bash (Bourne-Again Shell) its primary CLI, but even though this is Linux-like, Apple installs a very out-of-date version of Bash. The reason for this is that Apple, being a proprietary company, doesn’t like the very open GPL licensing of Bash and other Linux utilities. As a result, Apple has recently switched to making Z Shell (zsh) its default shell program, leaving an obsolescent Bash for those who might need it for Bash scripts that might not work in zsh.

There is nothing wrong with Z Shell. It has a few features that are better than Bash, such as slick directory changes, but Bash users who prefer to stick with Bash and prefer a more Linux-like command-line environment may wish to return to Bash.

Fortunately there’s a way to enjoy the best of both worlds — the lovely MacOS graphical interface that can run programs like Office 365 and Adobe products, as well as having the latest utilities from the Linux side of things.

Meet Homebrew

The secret is Homebrew, which calls itself “the missing package manager for MacOS.” If you know how to use the apt-get utilities from any derivative of Debian Linux, such as Ubuntu or Linux Mint, you will be very comfortable with Homebrew.

You first need to install Homebrew into MacOS, which you do using the Mac’s existing command-line tools by typing

% /bin/bash -c "$(curl -fsSL

If you’re running an Intel Mac, Homebrew will put up-to-date open-source utilities in /usr/local/bin. If you’re running one of the new Apple M processors, the utilities will be placed in /opt/homebrew/bin.

Homebrew installs with the latest version of Bash. On my M1 Macbook Air, Bash is version 5.1.8. The version Apple ships is 3.2.57.

One final step is required to use the tools more conveniently. You need to add the path to the new utilities to your PATH environment. You do this by updating your ~/.bash_profile settings. Open .bash_profile in the editor of your choice and add the following line for Intel Macs

export PATH=/usr/local/bin:$PATH

or for M-based Macs

export PATH=/opt/homebrew/bin:$PATH

Type $ source ~/.bash_profile and your pathing will be set and you can run the utilities from the command line and get the right set.

Switching to Bash as Default Shell

Setting Homebrew’s Bash Shell as the MacOS Default

To make Bash your default shell, Open Terminal -> Preferences and add the path your system needs to boot Bash. For an Intel Mac this would be /usr/local/bin/bash and for a Silicon Mac /opt/homebrew/bin/bash .

Adding and Removing Applications

Homebrew doesn’t stop with just the utilities. Many of the applications that are available in Linux are also available to the Mac. For instance, if you needed to do some PHP development on your Mac, you could type

$ brew install apache2 php


$ brew install ngnix php

You then have the latest general release of both the web server and of PHP (PHP 8 by default).

You can remove applications just as easily, e.g.,

$ brew uninstall ngnix php

And you can keep all your apps and utilities up to date by occasionally typing brew update followed by brew upgrade if there are updates to be applied. Notice how parallel the usage is to Linux apt.

If you run Apple silicon, most of the Homebrew utilities have been recompiled for the M processor. The utilities and apps that have not been recompiled run in Rosetta2, and they run about the same speed they do on Intel Macs. The M-compiled ones really zip along.

With your Mac now more Linux-like, you can add your favorite languages in the same way, e.g.,

$ brew install python3

Homebrew takes care of all the dependencies.

Using Brew

Brew Usage

Anyone who has used apt-get in Linux will feel right at home with these parallel Homebrew commands.

One last tip. If you would like a really attractive Bash interface with color coding and built in alias like ll for ls -l and la for ls -a, grab the contents of the default .bashrc file from Ubuntu or Linux Mint (or probably any distro that uses Bash as its default shell), and paste it into the top of ~/.bash_profile on MacOS and it transforms your environment from plain jane to Linux cool.

The synergy the Mac gets from these ‘Linux’ utilities and applications will take your command-line computing to a higher level.

Gene Wilburn is a computer generalist, tech writer, essayist, and photographer.

Full-Frame Photography on a Budget: Buy Used

Used Nikon D610 and 3 used lenses

By Gene Wilburn

For someone who cut their photographic teeth shooting with 35mm film cameras and lenses, full-frame digital cameras feel like a homecoming.

It’s not just the impressive image quality that comes from a full-frame sensor—it’s the instincts for the focal lengths you grew up with. A 24mm lens is 24mm with no crop factor. Not 38mm equivalent as with APS-C sensors, nor 48mm equivalent as with M43 sensors. 24mm, the real thing. The same for 50mm, or 85mm, etc. It’s a familiar world with a long and deep history that echoes back from the days of the earliest Leicas.

For someone on a restrained budget, however, full-frame can be a stretch financially. The latest cameras are dazzling things, most often mirrorless, frequently with image stabilization built into the camera body, and superb features, including tilt and swivel LCD panels for convenience when composing shots. Yet if you’re willing to move away from the leading edge of digital photography, you’ll discover that there are interesting deals to be found at the trailing edge.

The Trailing Edge

Think of the camera market as a kind of comet moving through time. The latest and greatest products form the bright head of the comet, its leading edge. The comet is then followed by a long tail, the trailing edge of discontinued models from the most recently discontinued to older models, stretching all the way back to film gear from the last century.

All along the way are deals to be had, for cameras don’t stop working because they’re discontinued. There are full-frame cameras from a relatively short while ago that were great cameras at the time but are now discontinued. Used ones in good shape have lots of service left in them, and they sell far below the price of the latest models.

Take my own case. I wanted to get back into full frame after having once owned a Nikon D610 DSLR, an intermediate-level body. I sold it when I was downsizing but soon had seller’s regret. So I scoured eBay and found another D610 advertised as being in “mint” condition. You have to be careful buying a camera unseen, but if you check the seller’s feedback you get some idea of how reliable they are.

I ordered my used D610 body from a camera seller in Japan. It meant a bit more spent on shipping and duties, but when the camera arrived it was immaculate. Cost: $675 USD. For $200-400 more I could have purchased a fine D800 body, but as an amateur photographer, I didn’t need all its features.

I knew I wanted a macro lens for it and for years I’ve been a distant admirer of the legendary Tamron Di 90mm macro lens. I found a “mint” one in Nikon mount from another Japanese vendor, for $200 USD.

I already had a 50mm f/1.8 Nikon lens so I had the middle ground covered. What I needed was a wide angle. From my experience with my iPhone (28mm equivalent) I knew I wanted something a little wider, so I located a good-condition Nikon 24mm AF-D lens for $150 USD.

My total base cost was just over $1000 USD for a full-frame camera plus two “new” lenses. Not bad considering a Sony a7C sells new, body only, for nearly $2000 USD and its lenses are expensive.

Recycling at its Best

I’m not a professional photographer and don’t need all the (lovely) bells and whistles of the latest models. And as a retiree on a fixed income, I have to be careful with my spending, so the prospect of recycling some of the slightly older, used gear is financially appealing.

It’s also a nice feeling to give a good used camera a new home rather than allowing it to sit idle on a shelf.

Buying used, as long as you’re careful about it, represents recycling at its best. As you can see from some of the photos I’ve added to this article, all taken from plants in our gardens, I’m a happy camper, very pleased to be photographing with my used gear.

A Darwinian Ramble


A Darwinian Ramble

By Gene Wilburn

I was always aware of evolution, in the vague sense that high school biology bestows, along with cell membranes, nuclei, zygotes, and stinky starfish dissection. It made a rough kind of sense and I was never a disbeliever, but I must admit my intellectual life received its biggest boost when I met Charles Darwin. Not literally, of course, but when you’ve read something someone has written, you do in fact meet them, in a virtual sense, and in that way my reading of Origin of Species granted me temporary access to one of the great minds of the Nineteenth Century.

Darwin’s prose style was honest and plain and his clear arguments persuasive. “Descent with modification”, or evolution, shaped life in all its enormity, complexity, and wonder, over time spans so long, with a past so distant, that the human mind can’t properly grasp the scale. Even today when the evidence pins the probable age of life on earth itself to over three billion years ago, that’s a meaningless number to us. After all, there are still extant cultures of hominid descendants who can’t count the number of pebbles in a bag because their native-language counting system goes “one, two, many.” Most of us are slightly more numerate than this, but beyond a small number set, we reach for a calculator. And so it is that we fail to fully appreciate the enormity of time.

Time. Deep time. In the same period as Darwin, Charles Lyell had published his Principles of Geology in three volumes, and Lyell opened Darwin’s mind to the concept of deep time. Given enough time, the speciation Darwin observed, both natural and domestic, had long enough to split and join and migrate and split and join and migrate and split ad infinitum into the diversity of life that has become the hallmark of our planet. When you recall that this was the time period in which geological findings were contradicting the account of the world in Genesis, the concept of deep time was beginning to rock religious beliefs and hold them up for critical questioning. If the world was indeed as old as the evidence was indicating, it’s an astonishing change in world view from the 6000-year estimate provided by Bishop Ussher in the Sixteenth Century, based primarily on a literal reading of the genealogy of ancient Hebrew patriarchs.

Context is important. While I introduced myself to Charles Darwin’s chief opus and subsequently read the account of his travels which we popularly call Voyage of the Beagle, I was serving as head librarian in the research library of the Royal Ontario Museum where I was surrounded by volumes of archaeological field reports, geological works, palaeontological studies, books on natural history, and shelves of scientific journals. Better yet, I had become friendly with several of the life science and earth science curators who were happy to field my questions about the earth and the life upon it. As a bonus, some of the research staff held an annual Charles Darwin Birthday Lunch every February 12th at which one of the researchers would deliver a lecture on their own research and how it related to evolution. In this context, I picked up much additional knowledge of evolutionary theory and how it has evolved, expanded, and become more nuanced since Darwin’s day.

So what has this to do with my intellectual life? It changed everything. I read Richard Dawkins’ Selfish Gene and started reading Stephen Jay Gould’s columns in Nature. Gould was one of my main influences and his works, collected occasionally into volumes of essays such as Ever Since Darwin and The Panda’s Thumb stretched my appreciation for the complexity of dealing with such a broad topic as evolution. What these scientist-writers showed me again and again is how hypotheses must be modified when new, conclusive evidence comes along to change the original assumptions. I liked the idea of “evidence-based” knowledge — knowledge that is honest and, as far as possible, untinged by bias. Nobody can exist as a totally bias-free being, but most scientists try to limit their biases when dealing with evidence. Philosophically, this appealed to me. From Darwin I learned objectivity. From Gould, deep time. And from Dawkins, the concept that our entire world view can be inverted if we think of humans as the human genome’s way of reproducing itself.

But to a philosophical person, science is as limited by its materialistic outlook as it is strengthened by it. Before my “history of the planet and all its denizens over time” reading, I had already amassed a motley background of humanities studies with courses in literature, art, philosophy, history, and linguistics. My M.A. in English reflected more my interest in the English language itself, than in literature, though the literature was a great perk, showing the brilliant and beautiful ways the English language can be expressed in the hands of its best writers. From the humanities I derived a deep respect for what I’ll call the human psyche. I don’t like to use the word soul because of its religious and supernatural connotations. And if anyone asks, no, I’m not an “old soul.” I doubt such a thing exists.

But I do think there is a spirit in the psyche of humans that can, in the right circumstances, lead to a flowering of art, literature, and philosophy, as well as science. Ours has become an intensely philosophical age in the sense of ethics. What are the ethics of how we treat other people, especially minorities or factions that are different from our own norms and traditions? What is the morality of abortion? What obligation, if any, do the rich have toward the poor? Who should be entitled to low-cost or free medical care? Is “assisted suicide” more humane than aging into a shell of what one was? Is it okay to modify human genes? Or more generally, what is the good life, and how can we help more people on the planet achieve it? There are issues everywhere, to the point of psychological exhaustion that is sometimes reflected in political voting trends.

I remind myself that no age I’ve ever studied has had it easy. Even as many aristocrats enjoyed bounty, they relied on the work of terribly poor, overworked and often undernourished peasants to keep things running. And wars and uprisings could lay low even the aristocracy. The Twentieth Century, after the terrible world wars, seemed to offer the promise of bounty for all, via capitalist economies. In the Twenty-First Century we see a reversing trend, where wealthy plutocrats enjoy great bounty, and the working middle class is shrinking in North American and European countries. Authoritarian governments are becoming more numerous, and even in Britain, Europe, Canada, and the United States, there are populist stirrings among folk who are fatigued with issues and a sinking lifestyle and want to “punish” those in power by voting for autocratic candidates.

It is possible we might be headed for a more authoritarian age and will elect our way into a less democratic society. It is becoming an age of fear and anger among a large portion of the population. The main fear is change, along with a nostalgic longing for the 1950s when increasing prosperity was the norm, at least for large members of the white middle class. How we treated our minorities in the 50s is another matter.

The problem with this problem of resentment and fear is that you cannot go back in time, or as they say in Lit classes, “you can’t go home again.”

In one of the subsequent editions of Origin of Species Darwin introduced the Malthusian phrase “survival of the fittest” to describe the thrust of evolution. In his later private writings he said he regretted using the phrase because it conveyed the wrong connotations. He wished instead he had said something like “survival of the most adaptable.” So much of modern life is about adapting to change. Those who adapt to the changes will be more likely to survive and, with luck, prosper. While nothing is guaranteed in life, staying nimble is a positive survival trait.

And so, I turn to Darwin for encouragement, even though it is stripped of religious and the supernatural:

There is grandeur in this view of life [natural history and evolution], with its several powers, having been originally breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and most wonderful have been, and are being, evolved.

We were not the first species on the planet, and we won’t be the last, but among those who truly embrace life in all its originality and variety, this is the time of humanity. Religion may offer people comfort, but philosophy asks the hard questions, such as what is our obligation to planet Earth itself? We have already driven many life forms to extinction, many just recently. Do we take a more caring role in our impact on the planet, or should we simply take, take, take until we, too, go extinct?

I have come to believe we need both science and the humanities to keep us on a rational course. We are from the earth and will each of us return to the earth. To a good evolutionist, such as I’ve become, that is it. So the intellectual question remains, if this is really it, how should one comport oneself, both socially and intellectually? The intellectual life is needed for perspective on questions like this and I think we must continue to learn and to educate, and, of course, adapt to the age in which we live. There is both power and positiveness in the human psyche. We have a brain unlike any other creature. Our obligation, it seems to me, is to use it.

Englische wel singest (th)u cuccu

Englische wel singest (th)u cuccu

Had I an ear for foreign tongues, French would fizz through my synapses in an embrace of lilac and elegance. The wine would be good too. Anglo-Saxon would flood my veins with tribal bonds and hard sinews, and roast meat, when you could get it. Icelandic and Old Swedish would carry me home to lands of ice and sea and foam and goddenknowing — the home of my ancestors. The gods know I hate mead. It’s a good thing I’m stuck in English, the earthy, quirky, surprising language mashed together from an Anglo-Celtic-Danish-Norman-Latin-and-less-Greek parentage. Stir in an industrial revolution, an electronic revolution, not to mention a few wars and the threat of the BIG bomb, pop some guys to the moon and back, joystick a rover on Mars, and whaddaya get? English. Hey, kiddo. Ya still with me? English is the best ride in the linguistic universe. Death-defying, roller-coaster spelling. Split into pools of speakers around the world who all think it’s the others who have an accent. And from the fifth grade when the first time you tried to spell antidisestablishmentarianism and got it right and can still do it but damned if you can remember how to spell covfefe without looking it up — I mean it’s an adventure, this English. One lifetime devoted to it is scarcely enough. To thee, or not to thee, English is the Hamlet of languages.

— Gene Wilburn, 6 Jun 2017

Life on the Trumpoline

Life on the Trumpoline

By Gene Wilburn

“No one expects the Spanish Inquisition!” ~ Monty Python

What irritates me the most about Donald Trump is that I have to think about him at all. I’m not a political person by nature and when it comes to governments I’m kind of a you-do-your-thing and I’ll-do-mine type. Try not to do anything too stupid, and I’ll do likewise. If too much negative stuff comes to my attention, I won’t vote for you next time. Up to now this has always been a more-or-less fair trade-off because the governments of the US, Canada, and the UK have been more-or-less sensible. They seemed able to get on with their business in fairly predictable, if muddling, fashion without needing my constant worry or scrutiny.

Lately, though, my concentration has been constantly interrupted by the strangest event in US history: the election of a reality-TV host who makes daily Twitter postings to vent his spleen, who tells Americans the mainstream press is the enemy of the people, who threatens, and when he can, fires all who don’t agree with him. He’s the Man Who Would Be King. Like most naive watchers, I assumed the office of the presidency would reshape him into something more restrained and, with luck, something a little more dignified.

What I hadn’t realized was that he would bring to office with him a group of Neo-Antebellum types who, given their druthers, would strip the US of all the progress it’s made made over the past several decades in the way of civil rights for all citizens. Or to strip away affordable medical care from everyone.

These are not normal day-to-day Republicans. They are people who ran Breibert News to spread false news stories, whacky conspiracy theories, hatred for Islam, anti-science propaganda, and a worldview whose only real message is White Supremacy and unrestricted corporate license. People who seem itching to get into a big war against some foreign government or other. People who espouse a fiery brand of righteous fundamentalist Christianity that is mostly about hatred and intolerance, all under the rubric of “making America great again.” Actually, America was doing pretty well before these people popped up like toadstools after a rain.

The mainstream news analysts can describe all of this better than I can. What I think about are the many others like me (millions?) who find this all a bit much, and whose psyches are being disrupted by a daily assault on reason and sensibility.

If you’re old enough, you may remember as a teenager listening to AM radio at night when you could dial in a good rock station from far-away Oklahoma or California that would fade out for awhile and some other staticy station on the same frequency would drift in and it might be a preacher or a newscast or a country music station, then the rock station would fade back in and for awhile they’d both be at the same volume and your brain would kind of bifurcate and try to process both stations at once, trying to separate the wheat (rock music) from the chaff (everything else). We weren’t meant to live that way, but that’s what’s happening to us now.

This New World is especially hard on those of us who suffer from depression. People aren’t mean to live on edge all the time. We need buffer zones — places or practices to give our minds soft landing points during the day, be it meditation, cozy mysteries, food preparation, yoga, a walk in the park, extra naps, Tai Chi, or music and art. Thoreau described himself as a “self-appointed inspector of snow storms.” I practice relaxation exercises and watch our backyard squirrels and birds from the kitchen window. Things that slow me down and soothe my psyche.

One of my problem areas is Facebook. I love Facebook for sharing art, kibitzing with my many talented, bright friends, sharing interesting developments in science and technology, and just generally keeping in touch with the people and seeing what they’re up to. But since the US election campaign started, the political news stories have started to dominate the feeds and an element of darkness has come over Facebook, filled with fear and loathing and little of it in Las Vegas. With Trump in the White House, it’s become the Big Shop of Horrors.

One of the solutions, of course, is simply to unplug from Facebook, and, in fact, I have friends who take Facebook breaks. Some have never come back, more’s the pity. Without the politics, Facebook can maintain a warm community of caring folk. But that’s just it. They’re caring folk, and they care about what’s happening south of the border. We all do. The US is a great country, seemingly on the verge of institutional, or perhaps constitutional, collapse.

In dealing with Facebook, I’ve discovered an interesting technological phenomenon. Facebook has more impact on a tablet using the Facebook app than it does when accessed via a browser on a computer. Because you hold an iPad or equivalent up close to your face, Facebook is literally “in your face.” Images and memes have greater power when viewed this way. When it’s positive, it’s lovely. When it’s negative, it triggers anxiety faster than it does in a browser.

The only tip I can pass on is this: when Facebook gets too much, delete the app from your iPad and switch to a browser. It makes the ugly stuff a little easier to take somehow. In a twist on Marshall McLuhan, it’s a case of “the medium is the messenger.” Removing the tablet app is the satisfying equivalent of shooting the messenger. At times one has to take pleasure in small acts of defiance.

Digital Black and White Photography, Pt. 8

Snow Bird

Plugins for Black and White

After exploring the techniques introduced in this series, you may think, yeah, they’re effective, but it’s a lot of work to get to a finished image. Aren’t there any shortcuts?

The happy answer is yes. Shortcuts can be found in the form of Photoshop actions and plugins, Gimp plugins, and in one of the most powerful black-and-white filters, Silver Efex Pro, by Nik Software, part of the Google Nik Collection. First let’s look at actions and plugins.

Adobe Photoshop has the ability to record and script techniques, saving them as Photoshop Actions. Several of these user-created actions are available for free on the internet, and some are offered commercially. Many Photoshop Actions will run in Photoshop Elements, though they can only be created in full Photoshop. There are also plugins available for Gimp, written in languages called Script-FU and Python-FU. Many of these actions and plugins are created to assist the colour photographer, but some can be adapted to B&W. You have to sift through them and try them out to see which ones are for you.

For convenience if you’re studying a Photoshop tutorial while trying to apply it to Gimp, a useful alternative for Gimp users is Gimpshop, a variant of Gimp that renames some of the menu items to correspond more closely with Photoshop.

For users of Photoshop, Photoshop Elements, and LightRoom, there is one “plugin” or filter program that is so good it’s in a class of its own. Let’s take a look at Silver Efex Pro. We’ll start in Photoshop with the image of a spider I shot in a window:



The colour in this shot adds very little to the image, plus there’s something in the brain that finds B&W creepier so I’ll invoke Silver Efex Pro from the menu with Filter > Nik Collection > Silver Efex Pro 2


What we see next is surprising the first time you invoke it because Silver Efex Pro transfers your image into a completely separate program that runs from within Photoshop:


This is a B&W photographer’s dream digital darkroom. In the centre is the image displayed initially as “Neutral.” On the left are over 30 presets, such as “High Contrast,” “High Structure,” “High Key,” “Low Key,” “Silhouette,” and one of my favourites, “Film Noir 1.” Every time you select a preset, the image changes to show you the effect, such as when I select “Dark Sepia.”


The right-hand side of Silver Efex Pro is where the controls are located and they’re extensive. In broad terms there are “Global Adjustments” such as Brightness, Contrast, and Structure, “Selective Adjustments” which features Nik’s splendid Control Points, “Color Filter” for channel mixing, “Film Types” which try to emulate classic B&W films such as Ilford Pan-F, Kodak Tri-X, and Ilford Delta 3200 Pro. You can add grain and control both the amount and the hardness or softness of the grain. Under “Finishing Adjustments” Silver Efex Pro offers different hues for toning and a superb vignetting tool. Using the tools you can create your own presets and save them as well.

When you click OK, Silver Efex Pro then performs its transformation and deposits it in Photoshop on a layer. Because of this you can either flatten the image or introduce some selective colour before flattening.

It’s hard to fully describe how much faster it is to create a B&W in Silver Efex Pro in contrast to doing everything manually in Photoshop. And because of the handy presets, it encourages you to view and study your image in several different interpretations before making a final selection.

For my final image I chose Film Noir 1, eliminated the border Silver Efex Pro had added, raised the Structure setting to give the spider sharper edges, and used a Control Point to eliminate the smudgy area of brightness in the lower left-hand corner:



This concludes the series on the craft of digital black and white photography. Thank you for visiting and I hope you’ve found some useful tips. You can contact me at

Digital Black and White Photography, Pt. 7


Vignetting for B&W

Vignetting a photograph simply means making the edges and corners of an image darker or lighter than the rest of the image. With subtle vignetting, the treatment subdues the background, leading the eye to the foreground. Heavy vignetting, especially dark vignetting, can create dramatic images.

Vignetting is nothing new and, in fact, many film cameras with less than superb optics, like the original Holga and most box cameras, vignette the corners of an image as part of the capture. I once owned a venerable Olympus XA 35mm compact camera whose signature look was darkened vignetted corners that looked terrific for street photography.

However, most of today’s digital cameras have excellent lenses that suffer very little optical vignetting, so to get the effect we must rely on post processing in an editor like Photoshop, Photoshop Elements, LightRoom, or Gimp.

There are many ways to achieve vignetting, which is great because it allows you to choose which method works best for a particular image. And, of course, vignetting works for both B&W and colour photographs, but vignetting, especially dark vignetting, has a special place in B&W photography. If you visit an exhibit of modern black and white photographs you’ll often see images that are purposely dark with heavy vignetting to create bold visual statements.

So, let’s examine three ways to create dark vignetting, using layers and layer masks to control the effect.

Method 1: Traditional Light Vignetting

Many B&W images look better with a touch of vignetting to draw the eye to the centre of the photograph. There’s a fairly simple technique using layers and the Elliptical Marquee Tool (as it’s called in Photoshop). This technique is applied after the rest of the post processing, such as cropping, contrast adjustments, sharpening, etc., has already taken place. It’s the final stage of getting a photograph ready for sharing.

We’ll begin with an image that’s almost ready to go and we’ll add a duplicate layer to the image,



and as you can see, I’ve drawn an oval over the centre of the image and have set Feathering to 10 pixels. Feathering creates a smooth transition from the centre of the image to the vignetted area. Now we invert the oval selection (Select > Inverse in Photoshop) and use the Levels mid-range pointer to slightly darken the inverted selection. This gives us a fairly subtle result:


Sewing Machine

You need a light touch with this method or the oval area will be apparent and look artificial. You can also increase Feathering to 50 or 100 pixels to get a smoother transition between the vignette and the centre of the photo.

Method 2: Gradiant Tool

Another classic method of creating a vignette is with the Gradient Tool on a layer. To explore this method I’ll use this converted B&W shot of ornamental kale as the starting point:


The centre of the image showing the kale with raindrops has promise but the rest of the image makes it look cluttered. To fix this create a duplicate layer and then choose the gradient tool.


This is a non-intuitive tool to use until you get the hang of it. Check the attributes of the tool and select the circular pattern (second from the left in Photoshop), and make sure Reverse is clicked on. At this point, click the left mouse button on the centre of the image and drag a line to the right of the image, going even beyond the right edge of the photo. If you’ve done it right, you’ll now have something that looks like this:


It may look alarming, but it’s okay. You can see how the gradient goes from white to black in a fairly smooth transition between the tonal zones. Next, in the Layers Palette, change the overlay type from Normal to Overlay. The result will look like this:


This is much closer to what we want as a finished image, but in the process of darkening the corners and edges, we’ve created a hotspot in the middle of the image. To restore the hotspot, the bright portion of the image, to what we previously had, create a Layer Mask and use a black paintbrush to brush out the lightness, returning that part of the image to our starting point.


With a final bit of tweaking with Levels to darken the blacks we end up with an image that is more satisfying than our original starting point:


Method 3: Artsy

Let’s have some fun with method 3, which I call “Artsy.” We’ll start with an image that, while it has promise, needs help to bring it out. Lots of help. Drastic help.


The image is soft with a lot background distraction and needs a serious contrast boost, but it has the potential to make a good photo.

This time, instead of making a duplicate layer, create a Fill Layer which in Photoshop is done with Layer > New Fill Layer > Solid Color, and select Gray. What you now get is an opaque black layer over the entire image. In order to see what we’re doing, go to the Layer Palette and change Opacity: 100% to Opacity: 50%. This is fussy work and you may make plenty of mistakes along the way which you can correct by changing the colour of the Brush tool to white and painting over any stray areas. How much you want shown in the final image is entirely up to you. For this one I ended up with a less cluttered, more dramatic result:


This is getting close to what I was after, but it needs more contrast and some sharpening. When that’s complete my final image looks like this:


while not perfect, it has far more punch than the original. Obviously you wouldn’t want to do this much work for most of your B&W shots, but it’s another technique you can use when you need it. It can work really well for a shot like this:


Next time, in the final installment, we’ll look at actions and plugins that can make a lot of what we’ve covered in the tutorial easier and faster.

Digital Black and White Photography, Pt. 6

Layer Masks

We covered Layers previously, now let’s dive into Layer Masks, one of the handiest tools in your digital darkroom toolkit.

Let’s start with this colour photo, a still life taken at Benares House Museum, Mississauga, Ontario.

Still Life

Now let’s convert it to black and white on a duplicate layer, but don’t yet flatten the layers. Click on the top B&W layer to make it active then click on the Layer Mask tool (as shown in Photoshop):


and click on the white Layer Mask on the B&W layer to make it active:


Almost there. Check the Background/Foreground Colour Setting to make sure that the foreground colour is set to black and the background colour is set to white.


Then select the Brush tool and we’re ready to work some magic on the Layer Mask:


Size the circumference of the brush ([ and ] in Photoshop) go to the image on the screen and paint a wavy line through the foreground onion:

You can see a record of this line on the layer mask:


What just happened? What we’ve done is remove the opacity where we brushed the onion, allowing the lower, colour layer, to show through. We’ve done this selectively rather than changing the opacity on the entire B&W layer and if we continue to paint the onion we can create a black and white image with an area of colour in it:
Because it’s a bit finicky to do the edges of the onion, you may have uncovered more colour than you intended (I did). To touch that up, go to the Foreground/Background Colour settings and click the curved arrows, reversing the black and white settings. Then with the foreground colour set to white, you can carefully erase your mistakes and return the opacity to the layer. A Black brush removes opacity; a White brush restores opacity. Hint: for fine work around the edges resize the brush to a tiny brush and increase the size of the image onscreen to 200%. This makes it easier to make a tidy edge.

As you can imagine, the Layer Mask tool opens a large range of possibilities that are exciting for both colour and black and white photography.

Next let’s look at how we can use the Layer Mask for purely black and white work, starting with this image of the Port Credit, Ontario, lighthouse and bridge in the snow:


Converted to black and white, the image is a bit grey and brooding and doesn’t convey the lightness of a snowy day.


This image would look better as a higher-key image, so let’s work on a duplicate layer and lighten the image overall:


This has a better overall feel, but it’s lost a bit of contrast and the lighthouse light is now overexposed. So, with the aid of a Layer Mask on the background copy let’s restore some of the darkness under the bridge as well as taming the lighthouse light.


I also restored some of the darker shades to the lighthouse door and trim as well as the roof of the adjoining building before flattening the layers.

Note: for even more subtle effects, you can lower the opacity of the brush tool itself, which is normally at 100%. If you wish to restore just a bit more of the underlying image, try setting the brush to 50% or 25% or even lower.

This is a fairly subtle use of the Layer Mask but it demonstrates that you can use masking to do the equivalent of very exact burning and dodging. Experiment with the Layer Mask and Brush until you feel comfortable using them and you’ll have added a powerful, creative option to your post processing.

Next time, how to create vignetting on B&W photos.