This ImageMagick command will make an image's white areas transparent:
magick convert FILE.png -transparent "#ffffff" TRANSPARENT.png

Here are three alternatives:
magick convert FILE.png -transparent white TRANSPARENT.png
magick convert FILE.png -fuzz 4% -transparent white TRANSPARENT.png
magick convert FILE.png -fuzz 4% -transparent "#ffffff" TRANSPARENT.png

Here is how to reverse the effect:
magick convert -flatten TRANSPARENT.png FILE.png

For step-by-step instructions, please read on.


Let us start with a canvas:

Onto our canvas, let us superimpose an image:
Blue diamonds with white background

The image's white background obscures much of our canvas. What if we wanted a transparent background?

This task is easy with ImageMagick: a free image editing software package that is available under relatively permissible license terms.

The following instructions explain how to install ImageMagick on your PC and turn the image's white background transparent. Non-PC instructions (Mac OS X, iOS, Unix) are similar.

Step-by-step Instructions for PC

Time required: about 10 minutes

  1. Download and install ImageMagick. Go to the ImageMagick download page and install the release of your choice. If you are on a PC, it is easiest to use the Windows installer. Be sure to select the option "Add application directory to your system path" because it will be needed for the rest of the tutorial: imagemagick-options
  2. Download the image. Right-click the image below. Save it to your folder of choice. For the tutorial, we will save it to the default folder: Downloads. Blue diamonds with white background
  3. Open the Windows command prompt. To bring up your command prompt, open your Windows Start menu and search for "command prompt". (Alternatively, hit WINDOWS+R and enter "cmd.exe".) You should see something like this: Windows command prompt
  4. Navigate to your folder. Type this command into your Windows command prompt, then hit enter: cd Downloads
    Windows command prompt with cd command
    This command says, "Open the downloads folder." cd stands for change directory. Indicently, as an alternative to typing commands, you can also paste commands into the command prompt using right-click.
  5. Run ImageMagick. Run this command inside your Windows command prompt: magick convert orig-2.png -transparent "#ffffff" transparent.png Windows command prompt with magick command
    This command says, "Use magick to convert convert our file orig-2.png. Invoke the -transparent option so that all white pixels, which are all pixels which have the the hexidecimal color #ffffff, become transparent. Name the new file transparent.png." Dashes (-) are commonly used to specify as options within command-line programs. Check ImageMagick's documentation for more details about convert.
  6. Success. Check your folder. You should now see a file entitled "transparent.png." Here is the final product:
    Blue diamonds with transparent background


How did it go? You are invited to share your feedback and any further thoughts in the discussion below, and please do not hesitate to connect with me via my contact page.

Lots of software programs could have done this job. Why did we choose ImageMagick? While ImageMagick is free to use for a wide range of purposes, that is not the end of the story.

Our next post will discuss the question "Why ImageMagick?" Using this post as a case study, we will dive into some of the other available options. We will also explore some of the implications of choosing open source versus proprietary software.

Header image used with permission from ImageMagick. Connect with them on Twitter at @ImageMagick.