Category: Old National 5

N5 – Graphic Formats (Revision)

Graphic Formats

JPEG (.jpg) Lossy compression

  • 24 bit colour.
  • Allows the user to select an appropriate level of compression.
  • JPEG is a good compression format for high-quality images and images where quality is unimportant (e.g. thumbnails).

PNG (.png) Lossless compression

  • Intended to improve upon GIF format.
  • 24 bit colour.
  • Allows user to set alpha level for improved transparency.

GIF (.gif) Lossless compression • Restricted to 8 bit colour.

  • Several images can be stored in one GIF file, allowing for animation.
  • Allows a specific colour in an image to be made transparent.
  • GIF is a good compression format for images with areas of flat colour, images that have few colours, animated images or images that require transparency.

Graphic file size calculations

To calculate the file size (in bits) of a bitmap graphic file the basic formula is:

number of pixels in image x bit depth

  • Bit depth or colour depth is the number of bits that were used to store the colour of each pixel.
    • 8 bit – 256 colours
    • 16 bit – 65536 colours (High Colour)
    • 24 bit – 16777216 colours (True Colour)
  • DPI (dots per inch) the number of pixels in a physical inch of paper.

Example 1
Calculate the file size of a 400 x 400 pixel graphic with a colour depth of 24.

400 x 400 = 160000 pixels in the image
160000 x 24 = 3840000 bits
3840000 / 8 = 480000 bytes
480000 / 1024 = 468.75 KB

Example 2
Calculate the file size of a 300 x 200 graphic with 256 colours.
256 colours means a colour depth of 8 (because 2^8 = 256)

300 x 200 = 60000 pixels in the image
60000 x 8 = 480000 bits
480000 / 8 = 60000 bytes
60000 / 1024 = 58.6 KB

Example 3
Calculate the file size of a 6’ x 5’ image, scanned at 200dpi, with 16 bit colour.

6 x 5 x 200 x 200 = 1200000 pixels in image
1200000 x 16 = 19200000 bits
19200000 / 8 = 2400000 bytes
2400000 / 1024 = 2343.75 KB
2343.75 / 1024 = 2.3 MB

Nat 5 – Our first program

Today in class we used TRACS to look at the program from last time, so we could better understand how it works and how the Python translator works.

  • A compiler changes all the source code (python) to machine (object) code. The machine code is then executed after all lines have been complied.
  • An interpreter changes one line of source (Python) code to Machine (object) code, this is then executed immediately.

The class was then set a new program to create.

Task

Write a program that takes in 3 numbers, calculates the total, then works out the change from a given amount.

Test data

2.99, 1.50, 3.00
10.00

N5 Python – Introduction

add2numbersOur 1st Python program makes use of a number of new constructs and variables.

# – Internal Commentary, anything after the # on the same line is ignored by the translator

= (Assignment) – values are assigned to the variables using an equals sign.

input() –  a string is captured from the keyboard using the input() function

int() – this function changes the datatype of the given variable to an integer (Whole number)

Expression – The expression is the right hand side of the =, this is evaluated and any calculations performed, the results are then assigned to the variable on the left hand side of the equals

print() – This function displays a string. The “,” is used to concatenate strings and add a space between them.

 

National 5 – Technical Implementation hardware requirements (Revision)

  • Input devices – put data into the processor e.g scanner, keyboard, mouse
  • output devices – display data from the processor e.g. monitor, printer, projector,
  • Processor type – dual, triple and quad code 
    • speed (Hz) – 1.8GHz to 3.4Ghz (faster)
  • Random Access Memory – used for current files, temporary storage of data which is lost if the device is switched off.
  • Read Only Memory – ROM retains its memory even after the computer is turned off.

Device types

  • Supercomputer – large processing power and memory, used by large organisations.
  • Desktop – processing power but not portable.
  • laptop – portable but generally less powerful than a desk top
  • tablet – portable but no physical keyboard.
  • smartphone – use 3G or connect to wifi. same functions as a tablet.

National 5 – Past Paper Revision

As discussed in class I have attached the presentations of the three past papers that are available.

 

  • Download the file
  • Open the presentation
  • Start the presentation
  • Write the answer for the question in an A4 pad. If you get stuck go research the answer in the “how to pass book” ( you can add this information to the powerpoint for future reference).
  • The answer are displayed in Yellow, so you can check them. Don’t just copy the answer!
  • Use the N5 course summary sheet to traffic light the section the questions came from, that way you are building a picture of the areas of the course that confuse you.
    • Green got it right without research
    • Yellow got it right after research
    • Red got it wrong
  • Use the course summary to plan your next revision target