001 by cuiliqing


									001 MWS

     Further Examples for
       Image Handling

                   Mary Thorp
                   March 2011
                  Document 001

          Computing Services Department
 Format Conventions
    In this document the following format conventions are used:

      Computer output is given in a Courier font.                 Password
      Input which is to be typed by you is in bold                a:\setup
      Input which must be replaced by your details is given       LOGIN user_name
      in bold italics.
      Keys that you press are bold.                               Enter
      Menu options and buttons are given in an Arial font.        File | New
      Notes are indicated by a bulleted book.                      This is a note
      Tips are indicated by a bulleted flag.                         This is a tip
      Warnings are indicated by a bulleted bomb.                     This is a warning

    The Computing Services Department welcomes feedback on its documentation. If you notice any
    mistakes in this document, or if you wish to make any suggestions on how the document could be
    improved, please contact Allyson Matthews, Information Officer. Electronic mail should be sent to the
    email address allyson@liv.ac.uk

          1 INTRODUCTION                                                                    3

          2 EXAMPLES                                                                        4
              Ghostly Text Example                                                          4
              Some Examples of using RGB Channels and HSL Channels                          6
              How to make faded backgrounds and faded edges                                 9
              Removal of Red Eye.                                                          11
              Other Red Eye Removal Methods:                                               12
              Seamless Tiling                                                              14
              Editing and Running PSP Script Files                                         16
              Blending Layers and Transparency                                             17

          3 FURTHER INFORMATION                                                            18

          4 APPENDIX                                                                       19
1 Introduction
  Paint Shop Pro X3 was chosen for this course in preference to Corel Paint X5 for a
  couple of reasons:

      Paint Shop Pro is owned by Corel Corporation and the development of PSP has
       been continued. There has been a new release most years since being taken over.

      We have a site licence for this very popular application.

      There are features in Paint Shop Pro X3 which are makes it easier to achieve
       various special effects; for example, red eye techniques.

  Paint Shop Pro in installed on the MWS. Also, staff and students can buy Paint Shop
  Pro X3 from the Helpdesk in Computing Services.

  The Appendix in Section 4 gives a few more details on the Paint Shop Pro X3 desktop
  and toolbox. If you have never used versionX3 of Paint Shop Pro before, this appendix,
  particularly if you want to find a tool on the toolbox, might help you to find your way
  round the package.

  This self-teach course is intended for people who have already followed the
  introductory workbook or attended the Image Handling course which used to be run by
  Computing Services a few times every year, until recently.

  It is hoped that, by following the examples in this workbook, the knowledge previously
  gained from attending the course is enhanced. If you need help with the examples in
  this workbook, please ask via the Helpdesk in Computing Services.

2 Examples
   It is assumed in this workbook that you are familiar with either Paint Shop Pro X2 or
   Paint Shop Pro X3 or with Corel Paint or with other image handling programs.
   Therefore, detailed instructions for every step are not given. If you become stuck, look
   at the online Help pages or seek help from the author of this workbook via the CSD

   Login on the MWS and start Paint Shop Pro X3. To load PSP X3, either double-click
   the Paint Shop Pro X3 icon on the desktop or click Start | Programs | Corel
   Paint Shop Pro X3| Paint Shop Pro X3. If you do not have Paint Shop Pro X3 on
   your desktop, then you can install it by clicking Start | Install University
   Applications | Paint Shop Pro X3.

Ghostly Text Example
   The first example is to show how to handle anti-aliased text on dark backgrounds. Anti-
   aliasing smoothes the jagged edges of text. It does this by softening the transition
   between the text and the background. So, for example, if the text is red on a white
   background, anti-aliasing would introduce pink pixels around the edges of the text.

   Problems can occur if the text has been anti-aliased against a white background and
   then used on a dark background. The text appears to be ‘ghostly’.

   1.   Create a new image with a white raster background and with width of 300 pixels
        and height of 200 pixels.

   2.   Add some text using font Tahoma with size 48. Use Black for both Fill and
        Stroke properties. The top one has anti-aliasing switched on (you can use
        Sharp or Smooth) and the second has it switched off. Notice one looks
        smoother than other. Use Layers | Merge to merge all layers.

   3.   Zoom into both so you can see how the anti-aliasing effect is produced.

   4.   Use File| Export | GIF Optimiser to create a transparent GIF file, asking for
        the White background to be made transparent.

5.    Import the GIF file into Powerpoint on a slide with a white background (click
      Insert | Picture). Then change the background to a dark blue.

The reason for this effect is that the anti-aliasing has created pixels with varying levels
of grey and so when the pictures are placed on a dark background, the grey pixels
appear as well.

What we need to do is anti-alias the text on a transparent background so that the
procedure creates pixels which are still black but with varying levels of transparency
instead. We cannot export to a GIF file since there are no facilities to hold varying
degrees of transparency – it is all or nothing! However, it is possible to export to a
PNG file (Portable Network Graphics) and keep the varying transparency information
for each pixel.

6.    Create a new image in PSP X3 with a transparent background and add both the
      text items; one with anti-aliasing switched on and the other with it switched off.
      Zoom in and check using the Dropper tool that there are varying degrees of

7.    Select both items of text and use Export | PNG Optimiser to create a PNG file.
      Click the Transparency tab and choose Alpha Channel Transparency and
      then Existing Image or Layer Transparency.

8.    Import the PNG file into Powerpoint and see the difference when a dark blue
      background is used.

Some Examples of using RGB Channels and HSL Channels
   These examples are to illustrate two colour models and how it is possible to switch
   between both models. The RGB model has three channels, each channel (red, green and
   blue) has 8 bits. The HSL has three channels too – they are Hue, Saturation and

   The next few examples also show how pictures can be split into channels. Various
   operations can be applied to the channels before they are combined again.

   1.   Create a new image 750 x 150 pixels in size. On the New Image dialog box,
        make the raster background a gradient of greens where at every pixel the Hue is
        85 and the Lightness is 128. The Saturation varies between 255 and 10.

   2.   First, use the Dropper tool to determine that the Blue component varies
        between 1 and 123 and the Green component varies between 255 and 133.

   3.   Next, click File | Preferences | General Program Preferences, click the
        Palettes tab and switch on Display Colours in HSL Format. Check by using
        the Dropper tool that the values for HSL along the picture are correct.

   To obtain the blue picture instead, shown below, we split the picture into three
   channels, one for Hue, one for Saturation and the last one for Lightness. As expected,
   the channels for Hue and Lightness both show a constant value throughout. The one for
   Saturation is a gradient of white to mid-grey. If we change the picture just for the Hue
   and recombine the channels, we should get a similar picture but with a different Hue.

   4.   Click Image | Split Channel | Split to HSL. You should obtain 3 new
        pictures. They are all greyscale; the lightness level in each one represents the
        value of the channel. Check, using the Dropper tool, that for the Hue channel, the
        value is 85 throughout and for the Lightness channel, the value is 128 throughout.
        For the Saturation channel, the value varies between 255 and 10.

   5.   Click the picture for the Hue channel and then click Adjust |
        Brightness&Contrast and increase the brightness by 90. The value for the
        Hue channel become 175.

   6.   Click Image | Combine Channel | Combine HSL. Check that the right
        pictures are being used for the 3 channels. You should obtain the blue picture.

   7.   Also check that the Hue and Lightness remains constant throughout the new

This is now another exercise on splitting channels, altering the constituent pictures,
representing the channels and then recombining the channels.

1.    Create a new image 750 x 150 pixels in size. We want a gradient of hues where
      at every pixel the saturation is 255 and the lightness is 127. Try first by creating
      a gradient from HSL of 0,255,127 to HSL of 255,255,127. You will need to
      put in intermediate pointers at

     25%          HSL of 63,255,127
     50%          HSL of 127,255,127
     75%          HSL of 190,255,127

2.    Use the Dropper tool and see that neither the saturation nor the lightness stays

3.    To make them stay constant, use Image | Split Channels | Split to HSL. Three
      separate greyscale pictures appear. We want to have full saturation, a gradient for
      the hues and a mid grey for the lightness.

4.    First, using the Flood Fill tool, make the picture representing the saturation all
      white. Next, choose a mid grey (palette index 127) for the picture representing
      the lightness. Lastly, choose a gradient going from black to white for the picture
      representing the hues.

5.    Use Image | Combine Channels | Combine from HSL to recreate the gradient
      of colours.

As an exercise, see if you can create the next picture using

     Image | Split Channel | Split to RGB

     Image | Negative (for the Red channel)

     Image | Mirror (for the blue and green channels)

     Image | Combine Channel.

To help you, note that where it was totally Red, it is now Black. Where there was no
Red at the middle parts, it is now White. Also, both the Blue and Green parts have
swapped sides.

This next picture is created by a gradient where the lightness goes from 255 to 0, the
hue is constant at 80 and the saturation of 255 is also constant throughout.

1.   Create a new image 750 x 150 pixels in size. We want a gradient so that at every
     pixel the saturation is 255 and the hue is 80. Try first by creating a gradient from
     HSL of 80,255,210 to HSL of 80,255,10.

2.   You will quickly find you have not achieved the correct effect. So try using Split
     Channel | Split to HSL and Combine Channel | Combine from HSL to
     create the correct gradient.

3.   Can you work out how to create the following using the above picture just using
     one Split Channel and one Combine Channel operation? You will need to
     split into HSL and then combine using RGB.

How to make faded backgrounds and faded edges
   The first example is a simple method - showing how to feather image edges into the

   1.   Open v:\psp\imcourse\rose.jpg and crop it slightly (Image | Crop).

   2.   Choose the Rectangular Selection tool and choose Rounded Rectangle or
        Ellipse. The Feather parameter has to be about 25. Make a selection around the

   3.   Next, invert the selection (use Selections | Invert Selection).

   4.   Set the background colour to a light grey and then press the Delete key.

   The next example shows how to fade the background.

   1.    Load the Rose image again. Duplicate your background layer (Edit | Copy then
         Edit | Paste as New Layer). Make the Raster1 layer invisible for the moment
         and select the background to be the current layer. Flood-fill this background
         layer with white.

   2.    Make the layer containing the copy visible again and make it the current layer.
         Use the magic wand or other tools to select just the Rose and stalk, making sure
         the value for Feather is 0 and the value for the Mode is Add for this process.
         The Tolerance for the magic wand operation needs to vary between 25 initially
         and 5 for the closeup work. Do an Edit | Copy and then Edit | Paste as
         Transparent Selection. Make sure that the two roses are coinciding!

   3.    Reduce the opacity of layer underneath by adjusting its Opacity Slider to about
         a level of 65 to 70.

   4.    Merge all the layers before you save the image.

The next example shows how to fade into the edges.

1.    Create new image (800 x 600 pixels so it is same size as the Rose image))
      containing a sunburst gradient. When editing the gradient, make the centre black
      and the outside white. Move the little slider along the top of the gradient to the
      right, so that most of the image will be black or dark grey.

2.    Create a mask from this image (Layers | New Mask Layer | From Image)
      and save the mask on an alpha channel (Layers | Load / Save Mask | Save
      Mask on Alpha Channel). Do not invert this.

3.    Load the Rose image, copy the image, paste as new layer, make new layer
      current and then load the mask from the alpha channel (Layers | Load / Save
      Mask | Load Mask from Alpha Channel). Again, do not use Invert

4.    Increase the brightness of the raster layer by 80%.

Removal of Red Eye.
   There seem to be many ways of removing ‘red eyes’ from photos and Paint Shop Pro
   has a dialog box for red eye removal. By fiddling with various parameters, it is possible
   to get authentic looking results. However, we have also included in this section some
   more manual ways of red eye removal to show you the principles involved.

   First, what causes photos to show ‘red eyes’?

   In general the red-eye effect does not depend on the eye colour. Light from the photo-
   flash enters the eye through the pupil and is reflected from the back of the eye. The red
   reflection comes back towards the camera making the pupil red. It needs to be turned
   into black, its normal colour. Sometimes, the reflection can be so severe that both the
   pupil and iris is one large red spot.

   Paint Shop Pro provides a Red-eye Removal filter. To use this:

   1.    Click Adjust | Red Eye Removal

   2.    For the method, choose Auto Human Eye, and give values of 9 for Pupil
         Lightness, 3 for Iris Size, 22 for Glint size, 100 for Glint Lightness, 2 for Feather
         and 1 for Blur.

   3.    Change the hue to Brown and then choose Hazel for the colour. Click in the
         middle of both eyes.

Other Red Eye Removal Methods:
      There are some of the methods that you can try. Some are better than others! It is
      interesting to see the techniques they had to use before the tools became more
      sophisticated. In all cases, you should make sure the image is using 16 million colours.

Method A: (Obtained from newsgroups)

      4.     Zoom in and choose a colour and use a small paintbrush to paint out most of
             the red. Do not remove the glint.

      5.     Find the Soften brush, make it small and soften the areas which you have just

      6.     Choose the Burn brush and darken the same areas. Incidentally, note there is a
             Dodge brush that can be used to lighten dark shadows on Buildings!

Method B: (Obtained from newsgroups)

      1.     Zoom in and use the Magic Wand tool to select the red areas only. The Mode
             should be Add. You will probably have to reduce the tolerance to 0 or 1.

      2.     You may like to feather the selection to one pixel. If so, then click Selections |
             Modify | Feather.

      3.     Zoom out again and make sure that you have not selected any other areas by
             mistake. If you have then change to the rectangular selection tool and use that in
             Remove mode to remove those areas.

      4.     Then use Adjust | Hue and Saturation | Hue, Saturation and Lightness. Click
             the small Colorise box. Adjust the other parameters.

      5.     Click Selections | None

Method C: (Similar to last method)

      1.     Zoom in and use the Magic Wand tool to select the iris and pupil areas. The
             Feather parameter should be set to 1 but the Tolerance to 0. Keep the Mode as

      2.     Now change the Mode to Remove and the Feather to 0 and the Tolerance to 1.
             Select the sparkle or glint areas in the centre of each eye..

      3.     Use the Saturate brush which is on the toolbox to desaturate and the Hue brush
             to change the colour of the selected areas.

Method D: (Obtained from newsgroups)

      1.     Use whichever method you like to select the red areas only.

      2.     Use Adjust | Colour | Red Green Blue to change the colour balance of the
             selected areas in the eyes.

Method E: (Obtained from newsgroups)

      1.     Zoom in on the eyes.

      2.    Use the Elliptical Marquee tool and create an elliptical selection starting in the
            centre of the eye and stop just outside to red area.

      3.    Go to Selections | Modify | Feather. and enter a value of 1

      4.    Go to Adjust | Colour | Channel Mixer.

      5.    Select:

                Output Channel : Red (very important)

                Source Channel Red : 0 %

                Source Channel Green: 50%

                Source Channel Blue : 50%

      6.    If necessary you can also select the option monochrome.

Method F: (Obtained from newsgroups)

      1.    Select the red parts only of the eyes using whichever method you think is best!

      2.    Select Adjust | Brightness and Contrast | Curves. switch to Default instead of
            Last Used and select the Red channel.

      3.    Click somewhere on the highest point of the line so that the input and output
            fields are enabled.

      4.    Put 255 into input and 0 into output. Click OK.

Seamless Tiling
    This example is to show how to create and store a pattern and then to show how using
    that pattern for a web page background does not always give the intended results. Paint
    Shop Pro has a new feature called Seamless Tiling and it is shown how this helps to
    reduce the impression of irregular tiling.

    1.    Open PSP X3 and create a new image with 200 x150 pixels
          and background of white.

    2.    On the Materials browser on the right hand side, click
          Foreground and Stroke Properties (large red rectangle on
          picture here).

    3.    Click the Patterns tab and choose the Animal Tiger pattern.

    4.    Click the little box by Texture so it has a tick in the box and then choose
          Bricks for the texture.

    5.    Click OK and then use the Flood Fill tool to fill the image.

    6.    Goto File | Preferences | File Locations, click on Patterns in the list and
          notice that patterns can be stored in your profile under the directory:

          C:\Documents and Settings\<username>\My Documents\My PSP Files\Patterns

          as well as in the PSP software area. So, you can now save this image as a PSP
          image file on your profile and it should then be picked up by PSP as a new
          pattern. Call it bricktiger.pspimage.

    7.    Create a new image 1000 x 750. On the Materials browser on the right hand
          side, click Foreground and Stroke Properties, click the Patterns tab and
          choose the bricktiger pattern. MAKE SURE you have switched off the

5.   Do a Flood Fill. You should obtain a similar effect to what is below!

6.   Close this image and reopen the bricktiger image (if you have closed this down).

7.   Click Effects | Image Effects | Seamless Tiling and accept the suggested
     defaults. Overwrite the file bricktiger.pspimage in this directory in your profile:

     C:\Documents and Settings\<username>\My Documents\My PSP Files\Patterns

8.   Create a new image of 1000 x 750 and again choose the bricktiger` pattern
     (make sure Texture is switched off). As you can see it is not perfect but it is an
     improvement over the original!

Editing and Running PSP Script Files
    Although this example is not designed to develop your knowledge of image handling
    techniques, it is possible that you have never used a script file in Paint Shop Pro. Script
    files can be useful if you want to apply a set of techniques repeatedly to different
    pictures. Always be careful about downloading internet script files – they can contain
    malicious code.

    We first open a picture and apply one of the sample script files. We make some
    adjustments to the script and save as a new script file and apply our new script file to a
    different picture.

   1.      Click View | Toolbars | Script. A new toolbar should appear, docked near the
           top. If this has not appeared, then you may have switched off the toollbar so
           switch it back on again! Select the Wet Watercolor script

   2.      Open v:\psp\imcourse\river.jpg and click the Run Script arrow on the
           toolbar.Then click Undo.

   3.      Next, click the Edit Selected Script button on the toolbar. Notice that there are
           3 commands which make the effective changes to the picture. These are:

               Brush Strokes
               Edge Preserving Smooth
               Coloured Edges

           If you have not met these before, have a quick look at the Help pages.

   4.      In the dialog box, click on Brush Strokes and then on Edit. The current values
           used when running the script are shown for a number of parameters. You are at
           liberty to try changing some of these. Also make some changes to the other two

   5.      When ready, click Save As on the Script Editor. Do not click Save since you do
           not want to overwrite the script file for WetwaterColor which is stored on the C:
           drive. Instead, save the altered script in the directory in your profile called

        C:\Documents and Settings\<username>\My Documents\My PSP Files\Scripts Restricted

            Call the script file MyWet.pspscript in this directory.

   6.      Click Close to close down the Script Editor, find the script MyWet in the list of
           sample scripts and apply it to the original picture.

   7.      Load another picture and apply the Wet Watercolour script. Undo and then
           apply the one you have just produced.

   8.      If you are interested in creating your own scripts, all you need to do is click the
           Start Script Recording button and then proceed. Click Save Script
           Recording to save the script file and save it in My Docs\PSPX3\ Scripts
           Restricted (change the path??)

Blending Layers and Transparency
 This next example shows the different ways of blending two layers, in which they can have
 varying degrees of transparency. For example, you can have a resultant layer which is the
 difference between two other layers.

 1.    First, open the file v:\psp\imcourse\pencils.jpg and resize it so that it is 500 x350
       pixels. You have to uncheck the little box for locking the aspect ratio.

 2.    Open a new images, 500 x350 pixels in size and with a raster background. Choose
       for the background a horizontal gradient going from red at the bottom to yellow at
       the top (there is one in the list). Do a copy of this and paste as a new layer over the
       pencils. You should now have 2 layers showing on the right called Raster 1 and
       Background. The Opacity of both is 100%

 3.    Select Raster 1 in the list. Go to Layers | Properties and choose Darken instead
       of Normal for the Blend Mode. Click OK. You should obtain the picture on the left.

 4.    Go to Layers | Properties and choose Difference instead for the Blend Mode.
       Click OK. You should obtain the picture on the right.

 The Darken blend mode means that pixels in the selected layer are displayed only if they
 are darker than the underlying layers. Pixels lighter than the underlying layers disappear.
 Most of the pencils have appeared apart from some of the yellow and orange ones

 Using the Difference blend mode subtracts the colours in the selected layer from the colours
 of the underlying layers. The vertical pencils have colour changes along their length,

 5.    You can try some of the other blend modes. Look at the Help pages for more details.

 6.    Now try changing the Opacity of both layers and perform a couple of the Blend
       operations. Incidentally, in case you have not met this before, the grey checks
       indicate that the resultant picture has a degree of transparency. To remove the
       transparency, you need to merge the layers. The most common way of merging is to
       use the menu item Layers | Merge | Merge All (Flatten) – this merges the layers
       into one background image.

3 Further Information
     More information about Paint Shop Pro X3 at Liverpool can be obtained at the web


       4 Appendix
             The picture below shows the Paint Shop Pro window when an image has been loaded.



The following shows the Toolbox in Paint Shop Pro X3.

 Dropper Tool

 Crop Tool

 Redeye Tool

 Makeover Tool

 Erase Tool

 Background Eraser Tool

 Picture Tube Tool

 Text Tool

 Pen Tool


To top