Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference...

23
Creative Computing

Transcript of Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference...

Page 1: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

Page 2: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ aims

By the end of the session you will be able to:

1. Explain the difference between various image file formats

2. Load in and display images in Processing

3. Translate, rotate and scale images

4. Create a variety of blends and transitions between images

5. Use for loops to manipulate images

Page 3: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ images

Images are represented as a grid of pixels

Called a bit mapThere is a colour value stored for each pixel

Page 4: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image files

Different file formats store this pixel data in different ways

Page 5: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image files

Bitmap vs vectorBitmap files represent images as a grid of pixel values

Vector graphics represent a set of lines and shapes that can be used as a recipe for creating an image

Page 6: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image files

Compressed vs UncompressedUncompressed Files just store the data directly

This takes up a lot of storage space

Compressed files reduce the amount of data by using special formats

Page 7: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image files

Lossless vs LossyLossy file formats compress the image in a way that means some information is lost

They can compress better than lossless formats (at a cost)

The least visually important information is lost

Page 8: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ aims

By the end of the session you will be able to:

1. Explain the difference between various image file formats

2. Load in and display images in Processing

3. Translate, rotate and scale images

4. Create a variety of blends and transitions between images

Page 9: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ Exercises

Load in and display an image that you have created

Make sure the window is big enough (the exact size of the image?)

Look up translate, rotate and scale, use them to change the position etc. of your image

Extra: Load 2 images side by side using transforms

Page 10: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ Transforms

Rather than changing the shape or positions of objects directly you can do so with transformstranslate – change positionrotate scale

Will work on anthing: shapes, images, groups

The command will affect anything that comes after it

Page 11: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ radians

Angles are always expressed as radians:

180 degrees = pi radiansConstants HALF_PI, PI and TWO_PIYou can use the radians function to convert to radians

Page 12: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ radians

Page 13: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ exercises

Try combining translate, rotate and scale in different orders

Extra: What difference does order make?

Extra: Where does it rotate/scale around?

Extra: Can you make it rotate around the middle of a shape?

Page 14: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing \\ order of transformsOrder matters when you do transforms

Generally, the best combination is:TranslateRotateScale

Page 15: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ aims

By the end of the session you will be able to:

1. Explain the difference between various image file formats

2. Load in and display images in Processing

3. Translate, rotate and scale images

4. Create a variety of image filters and blends

Page 16: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image filtering

Filters alter images by changing pixel values one by one

Different filters use different mathematical functions

e.g. invert sets each pixel to its inverse

threshold sets all pixels below a value to 0 all those above to 255

Page 17: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ image blending

Image blending takes two images and combines their pixel values

The pixel values at a point in image 1 are combined with those at the same place in image 2

Again you can use different mathematical functions

e.g. add the pixel values, or select the darkest or lightest of the two values

Page 18: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

Experiment with filter types: BLUR, THRESHOLD, POSTERIZE, INVERT, GRAY, create a nice effect

Load two images and do the same with blend types: ADD, SUBTRACT, DARKEST, DIFFERENCE, OVERLAY

Extra: Create an animated filter effect that changes over time

\\ Exercises

Page 19: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing \\ Create your own filterWouldn’t it be good to create our own filters?

All you need to do is go through all the pixels in an image and change the colour values

Page 20: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing \\ Create your own filterA lot of pixels: lots of work to do it by hand

Need a way of automatically stepping through all the pixels:

Loops!

Page 21: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ For Loops

The basic idea:You have a variable (e.g. x) that counts between a range of numbers

e.g. from 0 to the width of the screen

For each value of x you “Do something” (execute some commands)

Page 22: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

Create a gradientExtra: Create your own filter, e.g.:invert: converts the colour of a pixel to 256-colourThreshold: sets any pixel above a certain value to 256, and below to 0

Extra: Turn an image upside down using a loop

\\ Exercises

Page 23: Creative Computing. \\ aims By the end of the session you will be able to: 1.Explain the difference between various image file formats 2.Load in and display.

Creative Computing

\\ aims

By the end of the session you will be able to:

1. Explain the difference between various image file formats

2. Load in and display images in Processing

3. Translate, rotate and scale images

4. Create a variety of blends and transitions between images