CSS Prepare

optional · CSS study notes

Image Storage and Operations

CSS Optional — Paper-II, Section-B · P-II.V.IV · Storage-size numericals appear regularly (CSS 2017: 256 × 200 RGB, 24-bit). Operations on images are the building blocks of enhancement, restoration and change detection.

1. Image Storage — The Formula

  • Grayscale: bits = M × N × k
  • True-colour (RGB): bits = M × N × (k per channel × 3) — 24-bit colour = 8 bits × 3 channels → 2^24 ≈ 16.7 million colours
  • Indexed (palette) image: bits = M × N × (bits of index) + palette size (entries × 3 bytes)
  • Bytes = bits ÷ 8; KB = bytes ÷ 1024; MB = KB ÷ 1024 (state which convention you use)

2. Image Types by Storage

TypeBits per pixelNotes
Binary10 = black, 1 = white; documents, masks, morphology input
Grayscale8 (typ.)Intensity only, 0–255
Indexed / palette8 (typ.)Each pixel stores an index into a colour look-up table (CLUT); GIF
True colour24 (or 32 with alpha)Separate R, G, B planes
Multispectral / hyperspectralk × many bandsSatellite remote sensing (e.g. visible + infrared bands)

3. Raster vs Vector

  • Raster (bitmap): grid of pixels — photos; quality drops when enlarged. BMP, PNG, JPEG, GIF, TIFF.
  • Vector: shapes stored as mathematical primitives — logos, diagrams; scale without loss. SVG, EPS, PDF drawings.

4. Common File Formats

FormatCompressionBest for
BMPNone (or simple RLE)Raw storage, simplicity
GIFLossless LZW, max 256 coloursSimple graphics, small animations
PNGLossless (DEFLATE), supports transparencyScreenshots, graphics, text
JPEGLossy (DCT)Natural photographs
TIFFFlexible; usually losslessPrinting, scanning, archiving
DICOMLossless or lossy, with patient metadataMedical imaging (CT, MRI, X-ray)
RAWMinimal processing, 12–14 bitProfessional photography
WebP / HEIFModern lossy + losslessWeb and phone photos, smaller files than JPEG

5. Classes of Image Operations

ClassOutput pixel depends onExamples
Point (single-pixel)Only the same input pixelNegative, thresholding, gamma, contrast stretching
Local (neighbourhood)A small window around the pixelMean/median filtering, Sobel, morphology
GlobalAll pixels of the imageHistogram equalization, Fourier transform
GeometricPixel's position is movedTranslation, rotation, scaling, shear

6. Arithmetic Operations (pixel-by-pixel, on same-size images)

  • Addition / averaging: averaging K noisy images of the same scene reduces noise variance by a factor of K (std. dev. by √K). Used in astronomy and low-light imaging.
  • Subtraction: highlights differences — change detection, motion detection in CCTV, digital subtraction angiography (image before and after dye injection, subtracted to show only blood vessels).
  • Multiplication / division: shading correction (divide by the sensor's shading pattern); multiplying by a binary mask to keep a region of interest (ROI).
  • Overflow handling: results may leave 0–255. Rescale: fm = f − min(f), then fs = 255 × fm / max(fm).

7. Logical and Set Operations

  • On binary images: AND (intersection, masking), OR (union), NOT (complement / negative), XOR (pixels that differ).
  • On grayscale images: union = pixel-wise max, intersection = pixel-wise min, complement = (L − 1) − f.

8. Array vs Matrix Operations; Linear vs Non-linear

  • Image operations are array (element-wise) operations unless stated otherwise — multiplying two images multiplies corresponding pixels, not matrix multiplication.
  • An operator H is linear if H(a1·f1 + a2·f2) = a1·H(f1) + a2·H(f2). Sum and averaging are linear; max, min and median are non-linear.

📐 Worked Numericals

N1 — CSS 2017: storage for a 256 × 200 colour image, RGB, 24-bit depth.

  1. Pixels = 256 × 200 = 51,200
  2. Bytes per pixel = 24 ÷ 8 = 3
  3. Storage = 51,200 × 3 = 153,600 bytes = 153,600 ÷ 1024 = 150 KB

N2 — Indexed vs true colour: 800 × 600 image.

  • True colour: 800 × 600 × 3 = 1,440,000 bytes
  • Indexed with a 256-colour palette: 800 × 600 × 1 byte = 480,000 bytes + palette 256 × 3 = 768 bytes → 480,768 bytes (about ⅓ of the size)

N3 — Binary document: an A4 page scanned at 200 dpi (≈ 8.27 × 11.69 in) → ≈ 1654 × 2338 pixels × 1 bit ≈ 3,867,052 bits ≈ 483 KB before compression.

N4 — Averaging noise: averaging 16 frames reduces noise std. dev. by √16 = 4× (variance by 16×).

N5 — Proving max is non-linear (Gonzalez example): f1 = [0 2; 2 3], f2 = [6 5; 4 7], a1 = 1, a2 = −1.

  • Left side: max(f1 − f2) = max([−6 −3; −2 −4]) = −2
  • Right side: 1 × max(f1) + (−1) × max(f2) = 3 − 7 = −4
  • −2 ≠ −4 → max is non-linear.

N6 — Subtraction: A = [120 120; 130 200], B = [118 121; 130 90]. |A − B| = [2 1; 0 110] → only the bottom-right pixel changed significantly → motion/change detected there.


🎯 CSS Exam Angle

Storage numericals are free marks: always show pixels → bits per pixel → bits → bytes → KB, and state your unit convention (1 KB = 1024 bytes). For "operations" questions, classify first (point / local / global / geometric), then give one real application for each — examiners reward the applications (angiography, CCTV change detection, ROI masking).

📌 Past CSS Paper Frequency

YearQuestion
2017Storage in bytes for a 256 × 200 colour image, RGB, 24-bit colour depth
2017 (Web section)What is SVG; advantages over JPEG or GIF — raster vs vector knowledge overlaps

⚠️ MCQ Traps

  • 24-bit colour = 8 bits × 3 channels, not 24 bytes per pixel.
  • GIF is lossless but limited to 256 colours; JPEG is lossy; PNG is lossless.
  • Median and max filters are non-linear; mean filter is linear.
  • Image multiplication is element-wise, not matrix multiplication.
  • Averaging K images cuts the std. dev. by √K, not by K.

✅ Self-Check (with Answers)

Q1. Storage of a 640 × 480 image at 24-bit colour?

Ans: 640 × 480 = 307,200 pixels × 3 bytes = 921,600 bytes = 900 KB.

Q2. Why is an indexed (palette) image smaller than a true-colour image?

Ans: Each pixel stores only an 8-bit index into a colour look-up table (max 256 colours) instead of 24 bits of RGB, so storage is about one-third plus a small palette (256 × 3 = 768 bytes).

Q3. Give one application each of image addition, subtraction and multiplication.

Ans: Addition/averaging — reducing noise by averaging several frames (astronomy). Subtraction — change/motion detection, digital subtraction angiography. Multiplication — masking a region of interest, shading correction.

Q4. Is the median operator linear? Prove or disprove.

Ans: No. Linearity requires H(a·f1 + b·f2) = a·H(f1) + b·H(f2). Counter-example: f1 = {0, 0, 9}, f2 = {9, 0, 0} → median(f1) + median(f2) = 0 + 0 = 0, but median(f1 + f2) = median{9, 0, 9} = 9 ≠ 0.

Q5. Classify: histogram equalization, mean filter, image negative, rotation.

Ans: Histogram equalization — global; mean filter — local (neighbourhood); negative — point; rotation — geometric.

Q6. Raster vs vector — which for a company logo, and why?

Ans: Vector (e.g. SVG): shapes are stored mathematically, so the logo scales to any size without pixelation and the file is small. Raster suits photographs.

📜 Past-Paper Questions & MCQs (CSS 2016–2026)

2016 · Paper-II · Q7(a) · 6 marks

Q. Write a short note on array versus matrix operations.

Ans.

  • Array operations act element by element (pixel by pixel) on arrays of the same size: c(i, j) = a(i, j) × b(i, j). In MATLAB the operators are .*, ./ and .^.
  • Matrix operations follow linear-algebra rules: the product of an m × n and an n × p matrix gives an m × p matrix, each entry being a row-by-column sum. Inverse and determinant also belong here.
  • In image processing: images are matrices of pixels, but most operations (brightness change, masking, image subtraction, point processing) are array operations. Matrix operations are used for transforms and geometric transformations (a transformation matrix multiplied with coordinates).
  • Example: A.*B multiplies pixel by pixel (masking), while A*B is the matrix product.

2017 · Paper-II · Q7(b) · 6 marks

Q. Find the storage in bytes required to store a 256 × 200 colour image using the RGB model with 24-bit colour depth.

Ans.

  • Number of pixels = 256 × 200 = 51,200.
  • Bits per pixel = 24 (3 bytes: 8 bits each for R, G and B).
  • Storage = 51,200 × 3 = 153,600 bytes (about 150 KB), uncompressed.

2020 · Paper-II · Q7(c) and 2025 · Paper-II · Q7(b) · 6 marks

Q. Find the number of bits required to store a 256 × 256 image with 32 grey levels.

Ans.

  • 32 grey levels = 2⁵, so 5 bits per pixel.
  • Pixels = 256 × 256 = 65,536.
  • Bits = 65,536 × 5 = 327,680 bits = 40,960 bytes (40 KB). General formula: b = M × N × k, with L = 2ᵏ.

2023 · Paper-II · Q7(a) · 10 marks

Q. Transmission is in packets of a start bit, a byte (8 bits) and a stop bit, so 10 bits per byte. How many minutes would it take to transmit a 1024 × 1024 image with 256 intensity levels using a 56K baud modem? What would the time be at 750K baud (a typical DSL connection)?

Ans.

  • 256 levels = 8 bits = 1 byte per pixel, so the image has 1024 × 1024 = 1,048,576 bytes.
  • With 10 transmitted bits per byte: 10,485,760 bits.
  • At 56,000 baud: 10,485,760 / 56,000 = 187.2 s = about 3.12 minutes.
  • At 750,000 baud: 10,485,760 / 750,000 = 13.98 s = about 0.23 minutes (14 seconds).