Sunday, January 06, 2008

Replacing A Sky




“Cheating?”
Yep. Get over it. Most of us can’t drop everything and get the perfect shot on the perfect day, or stay in New York until the sky is great over the Statue of Liberty.

Keeping a sky library


Of course if you’re going to replace bad sky with a good one, you need to have a good sky handy. It’s tempting to bag a sky when it’s a dramatic sunset, and you should, but you should also have a collection of nice noon skies as well.
When you see a nice sky, shoot it both horizontally and vertically. Also use various focal lengths so you will have a pattern that matches the scene you’re trying to fix.

Bringing the two together


Start by opening both images in Photoshop. Adjust the image with the bad sky (the “main” image) for color, contrast, and density, and then flatten the image. The point here is to create a starting point where both images are compatible.
Select the sky with the magic wand tool.
Make sure “Contiguous” is unchecked. Even in this relatively simple example, there are numerous areas where the statue creates isolated areas of sky. We want them all to be selected.
Click with the wand out in the sky area. If the wand does not select the entire sky, there are a couple of things you can do to fix it. One is to deselect (ctrl-D), increase the tolerance, and try again. Another is to hold the shift key down and click with the wand again in the unselected area. The shift key puts the selection in “add” mode. A little plus sign will appear next to the tool.

How it works


The magic wand tool selects based on brightness. It adds and subtracts the value in the tolerance box to the value of the pixel where you click and selects all other pixels within that range. It does this for each channel. For example, let’s say a pixel of my sky is R229, G227, B222 (a slightly warm bright gray) and my magic wand tolerance is 15. The tool will select all pixels with a value in the range R(244-214) G(242-212) B(237-207)

The key is the selection


The magic wand tool is just one way to select an area. They key is to get the sky selected, not how it’s selected.

Copy the sky


Switch to the sky image. Press ctrl-a to select everything, then ctrl-c to copy.
Next switch back to the main image and make sure your ants are still on the march. Paste the sky into the selection with Edit -> Paste Into (shift-ctrl-v).
You will get a new layer and a mask.
You can position the sky by using the move tool (V). You can also stretch, shrink, or otherwise change the sky by transforming it. Press ctrl-t and drag the handles around to transform the sky. Skies can take an amazing amount of manipulation and still look good.

Fixing the halo


You may or may not get a halo around the edge. In the image above, the original is on the right; the image with the replaced sky is on the left. There are a couple of things to notice here. First the halo on the left is caused by the selection not being perfect, and the mask isn’t 100% right up to the statue edge. That’s allowing a pixel or so of the original sky to bleed through. (This shot is with both images enlarged to 1600%.) The other thing to notice is that no edge is always perfectly crisp at this level of zoom. Natural edges transition over 3 or 4 pixels.
If you have a halo, you need to fix it. Essentially what you have to do is refine the mask Photoshop created for you using the same techniques you always use to deal with the mask. What we’ll do is make the mask slightly smaller, allowing less of the background image to show through.
Zoom way in, use a very small brush and paint white on the mask along the edge.

Avoiding the problem


You may be able to avoid the problem by expanding your initial selection. After you click with the magic wand, use the menu to select Select -> Modify -> Expand and add one pixel to the selection.
Note that this isn’t always best. You may have some cleanup to do around the edges in the other direction. In this case, the edge of the torch is too sharp, and I need to use black on the mask with moderate opacity to smooth it out.
The best sky to replace isn’t a white sky, it’s a blue sky. Notice that when the edge selection isn’t quite right the halo comes not where there replacement has a cloud, but where blue is getting substituted on top of the original white. That original white shows up as a halo in the replacement blue sky. Where there is a nice white puffy cloud in the replacement sky, the white halo is still there but you can’t see it because it’s white on white and it looks natural. That means the best replacement of a totally white flat cloud sky is one with some blue but also a lot of clouds. It also means positioning the replacement sky clouds under your fine detail means less cleanup than positioning the blue replacement there.

Understanding Photoshop tools


If you’ve ever wondered what a tool or option does in Photoshop you’ve probably discovered that the Photoshop help file is totally useless. What the help system should have told you is in the Photoshop 6 Shop Manual by Donnie O’Quinn (ISBN 0-7357-1130-5). Alas it hasn’t been updated for later versions of Photoshop. Still, most of the tools you use and most of the options are unchanged from this version. For example, if you want to know how each blending mode works, or exactly what each option for the magic wand does, this book will tell you. It’s available used on Amazon from $9.49 to $39.99. There are 13 reviews, 12 five star, and 1 one star. The one star guy wasn’t arguing about the content, but bitching about the binding. I’d take it if it was loose sheets. As one reviewer said, Breathtakingly useful... an indispensable resource. There is really nothing else like it.

Non-Destructive Dodging & Burning


Dodging and burning is a practice in the darkroom as old as photography itself. Photoshop has built in tools for dodging and burning, but I don’t recommend their use. The reason is that the dodging and burning tools are destructive – they permanently change the pixel values in the image. What we really want is a non-destructive way to dodge and burn, like an adjustment layer. That way we can easily undo, throw away, or correct what we’ve done.

Transforming an Image


The original below was no better than forgettable, but with some cropping and the other techniques we’ve covered – and some dodging and burning – the potential comes out.

Creating a Dodging & Burning Layer


Make sure the layers palette is visible. Hold the alt key down and click the new layer icon in the layers palette.
This brings up the new layer dialog. If you forget the Alt key, Photoshop will just create a new blank layer and not display the dialog. If this happens, drag the layer to the trash can in the bottom right corner of the layers palette and try again.
With the new layer dialog up, enter a nice descriptive name, change the blending mode to “Soft Light” and click the check box. Each of these is important.

Applying Dodging & Burning


Once you’ve got your layer in place, paint directly on it with either white (to dodge) or black (to burn). Start with low brush opacity and build up the effect you’re looking for. Remember to release the mouse button between clicks. If you need to reverse the effect of what you’ve done, switch the brush color to the opposite one and go back over the area.
In dodged areas, I frequently find I need to add a little contrast, so I do that with a curves layer and a mask.
In the final image, the dodging and burning focuses the eye in the intended area of the image.

Dodging & Burning or Levels Layers & Masks?


You could achieve the same results using multiple levels adjustment layers with masks, but you will probably find when you have to tweak the image a dodging and burning layer is easier.

Non-Destructive Cloning



My favoite Texaco sign (in Talmo, GA) makes great cloining practice.
Let’s start by fixing my head-tilt. Select the entire image with ctrl-a, then transform it with ctrl-t. Twist the corner until it’s straight.

Clone on a new layer


Cloning on a separate layer gives us the opportunity to undo and discard our cloning. It’s much easier to fix our mistakes or change our mind this way. For example, if I did a photo essay on visual pollution caused by power lines, I’d want to bring those back.
Start by clicking the new layer button on the layers palette. If the layers palette isn’t visible, press F7.
Next, select the clone stamp (S). Make sure “Current and Below” is selected in the toolbar “Sample” options.
As you clone, the cloned pixels appear on the new layer, they don’t change the original layer. As a result, you can start over by throwing away the cloning layer. You can use this approach multiple times. For example, I might have one layer to fix the edges created when I rotated the image to straighten it out, and another layer to get rid of the power lines. This makes it easier to isolate choices and mistakes.

Tips for cloning


Work on the full size image


You want lots of pixels to play with. Start on the full size image, before you do any resizing. Zoom way in. Remember the space bar turns any tool into the hand tool, so you can hold the spacebar down, drag the image around, and when you release the spacebar the tool goes back to the clone stamp.

Modify the brush hardness to your task


Work with a soft brush when you’re not up against a hard edge. Work with a hard edged brush when you’re cloning near a hard edge.
Here I’m working with a brush size of 5px and a hardness of 90%. Away from the sign edge, I’ll use a larger brush, about 12px, and a hardness of 0%.

Use shift-click to clone in a straight line


Click once at one end of a line, such as the power line. Then position your tool over the opposite end of the line, hold the shift key down, and click again. The clone tool clones the entire line.

Avoid ghosting your target back in


You generally want to sample from as close to the target as possible so the tones and texture are as close as possible. Frequently though, you can run into yourself when cloning close by. The stamp tool clones by sampling the underlying pixels and copying them to the destination. It keeps taking from the underlying pixels until you release the mouse. The cross-hair indicates where the tool copies from. Note that in this case, I’ve moved the cross-hair to where the power line is and the destination down below the original line. Because of this, it copied the power line down as well, even though the area where the cross-hair is shows blank sky. The sample is coming from the underlying pixels, and the power line is still there.
When you release the mouse and click again, it picks up the changed pixels so it will begin copying clear sky. You have to balance the tedium of clicking a lot with the problems sampling from further away.

Know your keyboard shortcuts


· s for the stamp tool
· z for the zoom tool
· Spacebar for the hand tool
· [] (left and right brackets) to increase or decrease the brush size.

Aligned vs. Non-aligned


The “Aligned” checkbox controls where the sample starts from when you release and re-click the mouse. When you drag the mouse the sample position always moves in parallel to the brush. If the aligned box is checked, when you click again the new sample starting point is in the same relative position as the first time. If the aligned box is not checked, the new sample starting point is the original absolute position.

Layer order matters


In the image below, I’ve introduced a levels layer between the background and the cloning layer and adjusted the contrast. This brightened up the sky. Because the cloned pixels are copied from the lower level which is in its darker state, dark lines show up. Put your cloning layer directly on top of the image layer, or wait until the cloning is done and add the adjustment layer on top of both. Don’t forget you can change the order of the layers just by dragging them. Dragging the levels on top the clone layer fixes this problem.\

Working an edge


When cloning along an edge, you must take care not to distort the edge. To do this, you must line up the center of the sample with the center of the target. To do this, make sure the sample is right on the edge. When the alt key is pressed, the cursor turns into a “precision” cursor. Put it right on the edge before clicking the mouse. Without releasing the alt key, move the cursor to the clone target, and then click. If you need to later find the center again, you can press the alt key without clicking. Just holding the alt key down only shows you the center cursor, it doesn’t change the sample.

Wednesday, May 30, 2007

Multiple Images On One Canvas

I've received a number of questions on how to put multiple images on a single canvas. This is one of those Photoshop things that is really easy once you know how, and can reduce you to tears if you don't. This article will take you through the process one step at a time.


These steps will work in Photoshop and I believe will also work in Elements.


Get your images ready.



For each image, make your master file in Photoshop and save it as a Photoshop (psd) file. Get all the images to the "final" look before working on the multiple image canvas.


Start by creating a new image that will be your multiple image canvas.


Use File -> New. Size the image for your output. Resolution is important here, as all the images you work with will need to be sized the same. In this example, I'm creating a 13" x 19" print at 300 dpi resolution.


Next, open, flatten, and resize the images



I'm starting by taking each image and clicking Image -> Duplicate, and checking the "duplicate merged layers only" checkbox. For each image, after you do this, close the original. This accomplishes two things: First, you've reduced the memory your working image will take up by flattening it. Second, as you work with the image and resize it, you aren't impacting your original. Do this for each of your originals.


Resize each image


For each image, think of the size you want it to take up on your canvas. I'm making a 13x19 print with a long horizontal image and two vertical images. I'll make the horizontal image take up 9 inches and the vertical images 4 inches wide.


If you need help visualizing, turn on the rulers. On the menu, choose view -> rulers. You can also add guide by draging out from the rulers. The guides will help you position your individual images on the canvas.


To resize, click Image -> Image Size on the menu. When resizing, use the "document size" box in the middle. Set the resolution to be the same as your canvas. In my case, 300. Then set the width in inches. In my example, I've set it to 9 inches wide and let the height adjust automatically. Make sure the "resample image" check box at the bottom is checked.


Repeat this as necessary for the other images you're going to add to the palette.


Move your individual images to the multiple image canvas


Next make sure your layers palette is visible. If it's not select the menu item Window -> Layers to show it.



The image you just resized should only have one layer, but it may not be selected. Click the layer in the layers palette to select it.


Now use the move tool (press "v" on the keyboard), click on the image, drag it to the empty canvas, and drop it. Note that if your original images and your destination canvas are zoomed to different amounts, your image will look like it dramatically shrinks or expands. Don't worry. As long as you've set your image sizes correctly in the resize step, it will all come out OK.


Once you have each image on your multiple image canvas, you can close the individual image files. (Saving them is optional, you should still have your original master file.) You can move the individual images around on the canvas by clicking on the layer for the image in the layer palette, then draging them around using the move tool (the top right icon in the toolbox, or press the "v" key) and the mouse.


Repeat for each of your images.


Get fancy


You can add effects such as drop shadows on each image by selecting the layer in the layers palette and clicking the "style" icon at the bottom of the layers palette. The style icon is the one that looks like "fx". This will pop up a menu and you can select "drop shadow" and play around with the settings.


Here is the final image:

Wednesday, March 08, 2006

Got DSL?

As prices for high-speed Internet access continue to fall and digital photography interest continues to rise, many people are getting high-speed Internet access, either DSL from the phone company or a cable modem. If you have either of these and don't have a firewall, you're asking for real trouble. (This applies to Mac users too.)

A firewall is a piece of software or hardware designed to control access between your computer and the rest of the Internet. Because the nature of high-speed services is that they are always on, your computer is always exposed to the Internet. Every computer on the Internet has a unique numerically address. Yours is assigned automatically when you connect to your high-speed provider. Miscreants use automated tools to scan address ranges looking for open computers. "Humm, tonight, I'll attack Bell South users." Recently my work computers have had intrusion attempts from Korea, Eastern Europe, and Turkey.

A firewall acts like one-way glass, letting your computer see out, but other computers can't see in. If you've set up a home network, you probably have a router with a built-in (hardware) firewall, and you're probably in pretty good shape. If your computer is connected directly to the wall with DSL, or to a cable modem, you need a software firewall on your PC. A friend of mine had Bell South DSL. Their service tech installed it and got it working. But in an act of gross irresponsibility to their customers, Bell South doesn't install a firewall with their software or mention it. By the time I got there two weeks later, she had over 900 spyware files on her PC. Note that an anti-virus only product does not protect you against these.

Spyware is malicious programs that install on your machine and run. They range from the merely annoying (lots of pop-ups) to the seriously dangerous type that log your keystrokes as you type your password to your on-line banking site.

Spyware ends up on your PC in a variety of ways. Sometimes you give permission to install it without realizing it. Some "free" tools include spyware as part of the package. To get the cool free thing you also have to take the spyware. Thanks Gator! (you bastard) This is usually disclosed in such a way that only a lawyer with an electrical engineering degree would understand. And no one actually reads those license agreement you have to agree to. Other (the more malicious types) install themselves by exploiting holes in the operating system's security. And yes, even Mac and Linux users are vulnerable.

What can you do? You need security software. In fact you need three things: Anti-Virus software; a firewall; and spyware protection. The price ranges from free to under $100. Which is, well, free to worth-it. Here are the options:

  • Get a suite from your Internet provider. Suites include at least anti-virus and a firewall. Charter, my cable company, offers a suite free to customers with their highest speed offering, and at a cost for the cheaper services. Bell South makes you pay extra no matter what service you have. $83.88 a year. Plus tax! Yikes! Suites from your Internet provider are a great deal if they're free or you need simplicity and phone help. They do offer pretty good support installing the software.
  • Buy a suite. Norton Internet Security contains a full suite of products for $69.99. www.symantec.com. McAfee's product is $59.99. www.mcafee.com F-Secure is a Finnish company that makes an excellent product for $59.99. www.f-secure.com. Finally, consider GriSoft's AVG product. The company is in the Czech Republic but has good English email support. www.grisoft.com $48.95 for two years. (Other product require annual renewals.)
  • Go free. It takes a bit more work and a bit more savvy, but free products are available. First, Windows XP includes a software firewall. If you have nothing else, turn this on. It's ok, but I recommend a more robust product. For a free firewall, try Zone Alarm, www.zonealarm.com. For free anti-virus, try GriSoft's AVG Free Edition. For free anti-spyware tools, try LavaSoft's Ad-Aware, www.lavasoft.com, AND SpyBot Search-and-destroy, (www.safer-networking.org/en/download/index.html) AND Microsoft's Defender beta (www.microsoft.com). They're free, and none are perfect, so use all three. Most of these companies also sell a commercial product, so you might have to do a little digging on their sites to get to the free product.

Finally, test your vulnerability. There are excellent free tools at
www.grc.com/lt/leaktest.htm
and
https://www.grc.com/x/ne.dll?bh0bkyd2

These are both safe and very helpful. They are also seriously geeky. You can pretty much ignore the geeky stuff and take the default settings. I implore you not to do nothing.

Wednesday, December 21, 2005

How big is one pixel?


The truth is that a pixel, or picture element, has no fixed size. A pixel has value - this blue, this bright; and position - this many down, this many over; but not size.

Video devices, such as your monitor, display pixels of variable sizes. Take a look at how your monitor is set: Right click on an empty are of the desktop. Click on the settings tab, and look for the "screen resolution" slider. Within limits, you can set the monitor (really the video card) to display more or fewer pixels. Of course no matter how you set this, your physical monitor remains the same number of inches. Because your monitor is physically a fixed size but the number of pixels it displays can change, the number of pixels per inch is variable, as is the size of those pixels. The term "DPI" or dots per inch is frequently used when pixels per inch is really more appropriate.

But aren't all monitors 72 dpi?

No. Go back and read this again. Get out your ruler and measure the number of inches wide your monitor's image is. Then divide that into the number of pixels the display settings shows. In my case, it's 96 and change. And that's a consequence of the math, not anything the driver is doing. If you hook up a smaller monitor, your ppi goes up. With a larger monitor the pixels are spread across a physically larger space and the number per inch is consequently smaller. Or just forget about it. What's important when it comes to monitors is the number of pixels displayed, not how many inches of screen they're spread across.

The whole 72 dpi thing probably stems from the early days of the Apple Macintosh, when you could have any size screen you wanted as long as it was the exact single size (and resolution) Steve Jobs said you could have. 100 years later, Henry Ford is smiling.

Resolution For The Web


Recently, I was reading some Photoshop material written by an instructor I respect. Before I got two far, I had picked up a number of nice tips. Then it happened. The evil myth of 72 dpi. The instructions for sizing an image for the web or email make several references to setting the resolution to 72 dpi. It also mentions that if the "image size" is set to inches instead of pixels to set the inches to the desired size and set the resolution. This is soooo wrong.
Simply put, video devices don't understand inches, and the "I" in DPI is "inches". Let me say it again: Your monitor, video card, LCD projector, TV, etc do not understand the concept of inches.

So what is correct? The right thing to do is to ignore the "document size" part of the Photoshop image size dialog. Let's take a look at it. Access the dialog from the Image > Image Size menu. The dialog is divided into three areas: The pixel dimensions, the document size, and some options at the bottom. The most interesting part to us is the "Pixel Dimensions" part. Your screen is set to a display a particular number of pixels. Some common sizes are 800x600 pixels and 1024x768 pixels.

When I email someone an image I want them to just look at on the screen, or display on a video projector, I have to keep those dimensions in mind. If the resolution of the screen (or projector) is 1024x768, then that's the most it can display. Sending an image exactly that size will exactly fill the screen. Making the image larger will result in one of two things: The display software will resize the image to fit, or you will only be able to see part of the image. Either way, sending an image bigger than what the display device can display is simply a waste of bandwidth. It won't make it "better", and in fact might make it display worse. Photoshop is better at resizing images than most software, so that's where you want your resizing to happen.

For a web page, or if I don't want to fill the user's display, I'll frequently make the image even smaller than the display's maximum.

Let's say I want to size an image to no larger than 800 pixels on the longest side for display on my friend's screen. Here's how you do it:
  1. Open the image in Photoshop.
  2. Bring up the image size dialog with the Image > Image Size menu.
  3. Make sure the "constrain proportions" box is checked at the bottom of the dialog. If not, your image will be distorted.
  4. Make sure the pixel dimension section of the dialog is set to "pixels" not "percent".
  5. If the image has a horizontal orientation, set the width to 800 and let the height change automatically. If the image is vertical, set the height and let the width change.
  6. Make sure the "Resample Image" box is checked.
  7. Ignore the "Document Settings" "Resolution" box!
  8. Click OK.
When you do this Photoshop will correctly resize the image. Save it however you like. I nearly always use "File > Save For Web".

If you don't believe that resolution doesn't change anything, try this experiment:
  1. Resize the image as described above.
  2. Double-click the zoom tool to make the image display in Photoshop at 100%.
  3. Reopen the image size dialog.
  4. Uncheck "Resample Image".
  5. Change the "Document Settings" "Resolution" to 5 (yes five) pixels / inch.
  6. Click OK.
  7. Notice your image is still displayed at 100% and is still the same size.
  8. Reopen the Image Size dialog.
  9. Verify "Resample Image" is still unchecked.
  10. Change the "Document Settings" "Resolution" to 5000 (yes five thousand) pixels / inch.
  11. Click OK.
  12. Notice your image is still displayed at 100% and is still the same size.
The Document Settings > Resolution box is sets a tag in the image file to tell print devices how big to make the pixels. All video devices ignore it. When preparing files for video, web, and email, you should too.

Friday, December 02, 2005

What is the best method to backup images?

Q: WHAT IS THE BEST METHOD TO BACK UP YOUR IMAGES FOR QUALITY AND VOLUME? I HAVE HEARD A CD, STICK, OR EXTERNAL HARD DRIVE FROM DIFFERENT PEOPLE.

A: CD or DVD, two copies stored in different places. And don't shout.

You face these perils:
1) Electronic disaster (the drive gets corrupted or the smoke leaks out)
2) Physical disaster (the house burns down, the basement leaks)
3) Accidental deletion (OOPS!)

Another issue is file format obsolescence. Will the Photoshop of 10 years from now be able to read today's camera raw format (or PSD)? For this reason, some people recommend storing TIFF files instead of PSD or raw files for both the master and original image sets.

CD/DVD is a good option for all of these because it's cheap, durable, relatively permanent, and easy to make redundant copies. It's particularly good for archiving. The biggest downside is that people don't bother to make the disk. Also, they do tend to proliferate.

An external drive is no more safe than your internal drive. If the external drive *duplicates* your internal drive, then you have redundancy and are protected against 1 and to a degree 3.
It's common though to have a small drive in your laptop and a big external drive. Things get moved to the external drive to free up space, then it's on one drive. This leaves you subject to hard drive failure, etc.

Memory sticks are very expensive. $50 - $100 /gig, whereas CD/DVD is about $0.50 per gig or less.

Burn things to CD. Make an extra copy. Take the copy to the office.

Here's what I recommend:
1) Burn the original jpg or raw files (whatever you shoot) to CD-R or DVD-R as soon as they come out of the camera. Label it "Originals"
2) Do whatever manipulation you're going to do. When you're done working with a set, burn the manipulated images to another disk. Label it "Masters"
3) If you're working on a set over a long period of time, make a copy on DVD-RW or CD-RW as an interim step between 1 and 2. You can continue using this disk for different sets of images. It's your working backup.
4) If you'd really be unhappy if you lost the images, make a copy of the 1 & 2 disks and store them somewhere else.
5) About every 10 years, consider editing your collection and copying it to the latest media.