Edit bitmap images (selection, correction, resizing)

Graphics Creation – Editing Bitmap Images (Cambridge AS/A‑Level IT 9626)

Learning Objectives

By the end of this lesson you will be able to:

  • Select specific areas of a bitmap image using the appropriate selection tools, masks and layers.
  • Apply correction techniques – colour balance, levels, contrast, brightness and retouching – both globally and locally.
  • Resize bitmap images while preserving visual quality and understand the effect on resolution, file size and colour‑space.
  • Contrast bitmap and vector graphics, and outline the basics of frame‑by‑frame animation.
  • Choose the most suitable file format, explain compression and colour‑profile issues, and recognise ethical considerations when using graphics.

1. Bitmap Fundamentals

A bitmap (raster) image is a rectangular grid of pixels, each pixel storing colour information.

  • Resolution – measured in pixels per inch (ppi) or dots per inch (dpi). Higher resolution = more detail.
  • Colour depth – bits per pixel (bpp). Common depths: 8‑bit (256 colours), 24‑bit (true colour), 32‑bit (true colour + alpha channel).
  • Colour models
    • RGB – additive model for screen display.
    • CMYK – subtractive model for printing; conversion can shift colours.
    • HSL / HSV – hue, saturation, lightness/value; useful for selective colour adjustments.
    • CIELAB – perceptual model; often used when colour‑balance must be device‑independent.

Worked Example – Uncompressed file size

For a 1920 × 1080 pixel image at 24‑bit colour depth:

Size (bytes) = width × height × (bits per pixel ÷ 8)
               = 1920 × 1080 × (24 ÷ 8)
               = 1920 × 1080 × 3
               = 6 220 800 bytes ≈ 5.93 MB

2. Quick‑Reference Cheat‑Sheet (Exam Command‑Words)

Command‑wordTool / FeatureTypical Action
SelectMarquee, Lasso, Polygonal Lasso, Magic Wand, Quick Selection BrushDefine a region for a subsequent edit.
MaskLayer Mask, Vector MaskCreate a non‑destructive hide/show map (white = visible, black = hidden).
LayerNew Layer, Adjustment Layer, GroupSeparate elements so changes can be isolated or blended.
AdjustAdjustment Layer (Colour Balance, Levels, Brightness/Contrast)Apply colour or tonal changes without altering original pixels.
ResizeImage Size / Scale Image dialogChange pixel dimensions using an interpolation method.
ExportSave for Web, Export AsWrite the final image to the required format and compression.

3. Selection Tools, Masks & Layers

3.1 Selection Tools

ToolBest UseStrengths / Limitations
Marquee (Rectangular / Elliptical)Geometric shapesVery fast; cannot handle irregular edges.
Lasso (Freehand)Hand‑drawn outlinesPrecise control; hand‑shakiness can cause jagged edges.
Polygonal LassoObjects with straight edgesAccurate for angular shapes; requires clicking each corner.
Magic Wand / Colour RangeUniform colour areasQuick selection; tolerance must be set correctly.
Quick Selection BrushComplex subjects (people, foliage)Algorithm expands selection; often needs refinement.

3.2 Masks

  • A mask stores the selection as a greyscale channel (white = visible, black = hidden, greys = partial transparency).
  • Masks are **non‑destructive** – you can edit the mask at any time without altering pixel data.
  • Typical workflow: Select → Add Layer Mask → Refine (Feather, Refine Edge) → Paint on mask with black/white.

3.3 Layers & Adjustment Layers

  • Layers stack independent image elements; they can be reordered, hidden, or blended.
  • Adjustment layers (Colour Balance, Levels, Curves, Brightness/Contrast) apply changes only to the layers beneath them, preserving the original data.
  • Group related layers to keep the workspace tidy and to apply a collective mask or blending mode.
Common error: Applying the Clone Stamp directly on an adjustment layer can cause unexpected colour shifts – rasterise the adjustment layer first if you need to clone.

4. Correction Techniques

4.1 Colour Balance & Levels

  • Colour Balance shifts the contribution of each RGB channel in Shadows, Mid‑tones and Highlights.
  • Levels stretch or compress the histogram. Use the three sliders:
    • Shadows – left‑most slider.
    • Mid‑tones – centre slider.
    • Highlights – right‑most slider.

Linear stretch formula (input range a–b to output 0–255):

output = ((pixel – a) / (b – a)) × 255

4.2 Contrast & Brightness

Contrast expands the distance between light and dark values; brightness adds a constant offset.

newPixel = α × pixel + β
  • α (alpha) – contrast factor (α > 1 = higher contrast).
  • β (beta) – brightness offset (positive = lighter).

4.3 Retouching (Healing & Clone Stamp)

  • Healing Brush – samples texture from a source area and blends it to match surrounding tones automatically.
  • Clone Stamp – copies pixels exactly; useful for precise duplication but may need manual blending.

4.4 Exam‑Style Task

Task: Using the supplied photograph, increase the contrast of the sky by +30, brighten the foreground by +15, and remove a stray telephone pole using the Healing Brush. Save the final image as a JPEG with 80 % quality.

  1. Make a Lasso selection around the sky.
  2. Create an Adjustment Layer → Brightness/Contrast and set Contrast = +30.
  3. Make a Rectangular Marquee selection of the foreground, add another Adjustment Layer → Brightness/Contrast with Brightness = +15.
  4. Choose the Healing Brush, Alt‑click a clean area of the ground, then paint over the telephone pole.
  5. Toggle the adjustment‑layer masks off to review the whole image.
  6. Export → Save for Web (JPEG, Quality = 80 %).

5. Resizing Bitmap Images

5.1 Interpolation Methods

MethodHow it worksBest Use
Nearest‑NeighbourCopies the colour of the nearest pixel.Pixel art, icons that require hard edges.
BilinearWeighted average of the four nearest pixels.Moderate scaling where speed is a priority.
BicubicWeighted average of sixteen surrounding pixels.Photographic images; highest quality for up‑ or down‑scaling.

5.2 File‑Size Impact of Interpolation

InterpolationTypical File‑size Change (24‑bit)Visual Result
Nearest‑Neighbour (up‑scale 200 %)≈ 4 × original (pixel count quadruples)Sharp edges, noticeable pixelation.
Bilinear (up‑scale 200 %)≈ 4 × originalSmoother but slightly blurry.
Bicubic (up‑scale 200 %)≈ 4 × originalSharp with minimal artefacts; best for photographs.

5.3 Calculating New Dimensions

If an image of width W and height H is resized by a scale factor s:

W' = s × W  H' = s × H

5.4 Worked Example – Upscaling with Bicubic

  1. Original size: 1200 × 800 px.
  2. Desired scale: 150 % (s = 1.5).
  3. New size: W' = 1.5 × 1200 = 1800 px, H' = 1.5 × 800 = 1200 px.
  4. Choose Bicubic interpolation.
  5. Uncompressed size (24‑bit): 1800 × 1200 × 3 = 6 480 000 bytes ≈ 6.18 MB.
Common error: Disabling “Constrain Proportions” leads to stretched or squashed images.

6. Vector Graphics – A Quick Contrast

  • Definition: Images are described by mathematical paths (lines, curves, shapes) rather than a fixed pixel grid.
  • Key tools: Pen tool, Shape tools, Bézier curve handles, Pathfinder operations.
  • Advantages:
    • Unlimited scaling without quality loss.
    • Typically smaller file sizes for simple graphics (logos, icons, diagrams).
    • Easy colour‑profile changes – vectors are device‑independent.
  • When to use vectors: Logos, icons, UI elements, technical diagrams, any graphic that must be resized frequently or printed at many sizes.
  • Common vector formats: SVG (web), EPS (print), PDF (mixed).

7. Simple Animation Basics

  • Frame‑by‑frame animation – each frame is a separate bitmap layer; the timeline plays them in sequence.
  • Export options
    • Animated GIF – up to 256 colours, suitable for short web loops.
    • MP4 / WebM – video codecs, full colour, longer duration.
  • Key‑frame concept – define the start and end states; the editor interpolates intermediate frames (available in advanced raster editors).

8. File Formats, Compression & Colour‑Profile Considerations

FormatCompressionTypical UseColour‑space / Metadata
JPEGLossy (quantisation)Web photographs, emailRGB; embeds EXIF & ICC profile.
PNGLossless (deflate)Web graphics, screenshots, transparencyRGB or indexed; supports gamma & ICC profiles.
GIFLossless (LZW) but limited to 256 coloursSimple animations, iconsIndexed only; no colour‑profile support.
SVGVector (XML‑based)Scalable icons, diagrams, UI assetsDevice‑independent; styling via CSS.
TIFFLossless (LZW, ZIP) or lossy (JPEG‑TIFF)Print production, archival storageSupports CMYK, ICC profiles, multiple layers.

Compression & Quality Tip

When saving a JPEG, a quality setting of **80 %** usually offers a good balance between file size and visible artefacts. Always preview at 100 % zoom before finalising.

9. Responsible Use of Graphics

  • Verify that you have the legal right to use an image (copyright, licence, Creative Commons).
  • Provide appropriate attribution where required.
  • Avoid misleading edits – e.g., altering a portrait in a way that could be defamatory.
  • Consider accessibility: add concise alt‑text for web images.

10. Practical Workflow (Step‑by‑Step)

  1. Open & duplicate: File → Open, then duplicate the background layer (Ctrl + J).
  2. Select the area: Choose the most suitable selection tool; refine with Feather (1–5 px) or Refine Edge.
  3. Mask (optional): Click “Add layer mask” to keep the edit non‑destructive.
  4. Apply corrections:
    • Adjustment layer → Colour Balance / Levels.
    • Adjustment layer → Brightness/Contrast.
    • Healing Brush or Clone Stamp on the masked region.
  5. Review: Toggle mask visibility or press Ctrl + D to deselect and see the whole image.
  6. Resize:
    1. Image → Image Size (or Scale Image).
    2. Enter new dimensions or a percentage; ensure “Constrain Proportions” is checked.
    3. Select an interpolation method (Bicubic for photos, Nearest‑Neighbour for pixel art).
    4. Confirm.
  7. Save & export:
    • For web: File → Export → Save for Web (PNG‑24 or JPEG 80 %).
    • For print: File → Save As → TIFF (CMYK, embed ICC profile).
    • Keep a master copy in the native format (PSD / XCF) with all layers intact.

11. Common Pitfalls & How to Avoid Them

  • Distorting aspect ratio: Always lock the width‑height ratio when scaling.
  • Quality loss on up‑scaling: Use Bicubic interpolation; if the image is a logo, recreate it as a vector.
  • Hard edges after selection: Feather the selection or apply a slight Gaussian blur to the mask.
  • Colour banding after heavy contrast changes: Work in 16‑bit mode or add a subtle noise layer.
  • Saving JPEG at too low quality: Preview at 100 % zoom; increase quality if banding or blockiness appears.
  • Forgetting colour‑profile conversion: Convert RGB → CMYK before sending to a printer to avoid unexpected colour shifts.

12. Self‑Assessment Questions

  1. Explain the difference between a selection and a mask. When would you choose one over the other?
  2. Calculate the uncompressed file size of a 3000 × 2000 pixel image saved at 32‑bit colour depth.
  3. Given an image that must be reduced from 2500 × 1800 px to 1250 × 900 px, which interpolation method would you select and why?
  4. List three situations where a vector format (e.g., SVG) is preferable to a bitmap format.
  5. Describe the steps required to create a 5‑frame animated GIF from a single photograph where the subject moves across the frame.

Create an account or Login to take a Quiz

40 views
0 improvement suggestions

Log in to suggest improvements to this note.