Image Manipulation


The Magic of Masks

The first part of this tutorial will teach you how to create a mask in Paint Shop Pro 4 and the second how to do it in the new version 5.

PSP 4 Masks Selections

OK, you have this great image. But it is trapped in an impossibly busy or dark background. How do you get that image out of the background so you can merge it with another image? I took the following two images and merged them into one image by using a mask to extract the flower from the varied green background.

   

Now, on to masks. When you understand the theory behind masks and how to manipulate them, they are very easy and straightforward. This is how to extract an image through use of a mask:

  1. Open the image and make sure it is 24 bit, 16 million colors.

  2. Click on Masks|New|Empty, then Masks|Edit. Don't worry that your image is now completely black.

  3. Set your foreground color to white and background color to black.

  4. Click on View|Through Mask. If you are not now looking at your image through a red mask as follows, you need to set your File|Preferences|General Program Preferences|Miscellaneous "Viewing Image Through Mask" to 50% red.

  5. Now you need to start painting. Set your paintbrush to a large round brush (I used 30) with no paper texture. Start painting in the middle of the picture you want to extract. When you paint with the white, you remove the mask, when you paint with the black, you add the mask back. It's much faster if you start with a large brush to remove the mask from the interior. When you get to the point where you are getting close to the edges, switch to a smaller brush size. The following is what my picture looked like after much of the interior mask was removed:

  6. When you are working with a smaller brush and getting close to the edges, you might want to blow up your picture somewhat. If you go too far outside the picture, switch the foreground color to black (click on the arrow-line between foreground and background), and repaint the mask with the black.

  7. When you have removed the mask to your satisfaction, choose View|Through Mask. You will now be looking at a black/white representation of your image similar to the following:

  8. Now is the time to touch up your mask by painting out the remaining black.

  9. Once the mask is clean, choose the Magic Wand tool and set the feather to at least 1. Click on the white area of your image. Then go to Masks|Edit to uncheck the "edit". You should now be looking at your image with the selection around it.

  10. Copy this image (Ctrl C or Edit|Copy) and paste it into a new image. If the image looks clean, then paste the image into your other image. If the edges look dark or ragged, Select None on your original image, go back to Edit|Mask, View Through Mask again and clean up your edges.

The following is what my final image looks like (I resampled the flower while it was still selected on top of the background image to make it fit better):

PSP 5 Masks Selection

The following is how you would complete the masks selection in the new 5.0 version of Paint Shop Pro.

  1. Open the image and make sure it is 24 bit, 16 million colors.

  2. Choose the Freehand selection tool (the Lasso). Set it to Smart Edge and check the Antialias box in the Controls Palette.

  3. Click on the edge of the carnation, move a little, click again and keep moving around the edge of the carnation. The "smart edge" samples the colors and snaps your selection to the color closes to where you are clicking.

  4. When you have your whole flower selected and you have met your starting point, double click. This will join the entire selection.

  5. Choose Masks|New|Show Selection from the top menu (this actually creates the mask for you). You will now see your carnation and the background will be a checkerboard. This means that the background is now transparent.

  6. Choose Masks again from the menu and click on View Mask and Edit. You will now see your selected flower with a reddish background.

  7. Since there are still some dark pixels around the edge of the flower, you can clean them up now. Set your foreground color to black and set your paint brush tip to 2 pixels. Use the zoom tool to zoom in on your graphic.

  8. Click on the stray black pixels with the paint brush. This will take the black away and allow the red from the mask to show through. This is good.

  9. When your mask is cleaned up the way you like it, click on the flower with the Magic Wand. This will select the flower. Contract your selection by 1 (Selections|Modify|Contract) then feather your selection by 1 (Selections|Modify|Feather). This smoothes the edges so they will transition well into the backgkround. Turn off Masks View and Masks Edit. Copy your selection.

  10. Open your background (in this case the bush). Choose "Paste As a New Layer". Name this new layer "Flower" (right click on the layer selection and choose "Properties). You now have a two layered graphic. The bottom layer is the bush and the second layer is the flower with the backround around the flower transparent so the bush shows through.

  11. If you want, click on the Flower layer and play with the opacity slider.

  12. When you are done with your graphic choose Layers|Merge|Merge All. Save your graphic as a jpg (File|Save A Copy As).



More Masks...

Sometimes you can use a mask to retrieve part of an image. The following image of my husband's favorite woman (next to me...of course), Ms. Betty Boop, was hopelessly lost in the black background. There was no way to get Betty out of the black background intact using the Magic Wand. As you can see in the graphic on the right below, a Magic Wand selection of Ms. Boop left out a lot of her head! But, was there really a need to mask her whole "self" out of the image...a rather tedious endeavor?

     

Instead of masking her whole body, I just made a mask of her head (as outlined in the "Magic of Masks" instructions above) and saved the mask (Masks|Save, I named it Boop.msk). The graphic on the left below shows the mask, the graphic on the right shows the mask selected.

     


I then made a selection of the background in the image using the Magic Wand (my tolerance was 50 with a feather of 2), inverted the selection, made a copy of the selection, and pasted it into a white background (left image below). I deselected everything and loaded my saved mask. I then chose Masks|Edit, selected the mask with the Magic Wand, chose Masks|Edit again (this removed the mask and left the selection..as in the right graphic above), and then made a copy of the selection. I switched to the incomplete graphic of Ms. Boop on the white background and pasted her head "As a New Selection" and moved her head into its proper position. Viola! Ms. Boop and her head are reunited into a complete graphic!

     



Combining Two Images

Heres an image of a wizard staring off into space. Wouldn't it be nice to give him something to look at? Lets have him staring off at earth (this must mean he is on the moon!)

  • Open the two images.
  • Select the earth with the marquee tool set to circle.
  • Copy the selection and paste on the wizard picture.
  • The first picture with the earth is just a copy and paste.
  • For the second picture, I feathered the earth to 3 before copying, pasted onto the wizard picture, then lowered the opacity to 80%. I think this made the merging of the two graphics more realistic.

Combining Multiple Images

Recently, while cruising a CD of pictures, I came across all these great fantasy images. I thought these would be a good example of how to combine different images into a collage. The following are thumbnails of the images used in the final collage:

      
      

The following method works well with images that have a solid color background. To create a collage:

  1. Open a new image somewhat larger than you want your final image to be (you can always resample it to make it the final size), set to 16 million colors.

  2. Open your first image. To crop the image from the background, do as follows:

    • Select the entire image (Shift A or Select|All)
    • Right click on the background color of the image (this sets the background color in PSP).
    • Go to Selections|Modify|Transparent Color and set the Transparent Color to Background Color and the tolerance to somewhere between 20-50 (you might have to experiment here)
    • Click OK.
    • You should now have everything selected except for the background color (it has been made transparent).

  3. Make a copy of your selection (Ctrl C or Edit|Copy).

  4. Move to your new graphic and paste the copied image (Ctrl E or Edit|Paste As a New Selection). You can test your selection first by pasting it into a blank graphic with a white background. This will show you if you got all the colors in the image and whether the edges are clean.

  5. Deselect the image. If there are still parts of the background color clinging to your pasted image hit undo and delete and go back to selecting the image again, increasing the tolerance.

  6. If the image looks good, but is too big, hit undo (this reselects the image) and resample the image. When you resample with a selection, it resamples just the selection, not the whole image. Once you have the image the right size, deselect and repeat with the remainder of the images.

  7. You might want to flip or rotate an image. I used Image|Mirror on Merlin since he was going in the wrong direction.

Since all you have selected each time is just the image and no background, you can place one image over another and they will blend together.

You can also use the Magic Wand to select the background (always have a feather of at least 1), invert, copy and then paste. I prefer the above method, though, because if you have background color inside your image, you will have to select it manually (hold down the shift key and click with the Magic Wand to add to a selection). When you use the transparency method, all the colors matching the background color set will be made transparent and you won't have to do the adding to the selection.



Cleaning Up a Selection

Selecting an image on a light background and pasting it on a dark background can create a problem. I selected Neptune from a white background (using the Selections|Select All - Selections|Modify|Transparent Color method outlined above) and pasted him into a dark background and you can see the problem resulting below (the second picture). I solved this problem by feathering the selection (Selections|Modify|Feather...I used a feather of 5), invert the selection (Selections|Invert) and hit the delete key (make sure your background color is still the same as your background currently). This takes off the "jaggies". Final version of Neptune on black is on the right.

    



Old Photo

HalfDome

You can find plugins to create an "old photo" effect. But, it is very easy to do without a plugin and you have more control over the finished product. I took a color photo of Half Dome and made it into an "old photo" using the following technique:
  1. Open the photo you want to apply effect to. Make a copy (Window|Duplicate). Work on the duplicate so if you need to start over, you can just duplicate the original again.

  2. Greyscale the image then return to 16 million color mode.

  3. Adjust the brightness and contrast if necessary (I applied 20% brightness to my photo, since it was pretty dark).

  4. Duplicate the photo (Window|Duplicate).

  5. Fill the duplicate image with a dark color you think would make a good overlay (I used r:111, g:84, b:2).

  6. Reduce the opacity of the colored image (I reduced mine to 30%).

    • Selections|Select All
    • Selections|Modify Overall Opacity
    • Set opacity to a low setting

  7. Copy the colored image.

  8. Switch to the photo and paste "As a new selection".

Experiment with different shades of brown until you get the color you want. Note: If you want to try another color, close your current colored image and make another copy of the original photo to fill with a new color. The old copy of the color already has the opacity reduced and you won't really know where you are if you try to reduce it again.

Hint: My "old photo" was still too dark for my taste. So I made a copy of the "old photo" version, selected all, lowered the opacity to 90%, made a copy and pasted as a new image. I liked the new image, so I saved it over the old. Lowering the opacity of a photo image sometimes works better than adjusting the brightness and contrast of a dark photo.