Pixelate an Image

My instructor wrote this:

One way to pixelate an image is to effectively make every nXn non-overlapping window contain the same value (the obvious value is the average of the window). For example, if n=2, the following image:
10 20 30 40
11 21 31 41
12 22 32 42
13 23 33 43
may be transformed to:
16 16 36 36
16 16 36 36
18 18 37 37
18 18 37 37
where the 16 was computed by averaging 10, 20, 11, and 21 (after rounding), and so on.

I have no idea how to start creating this program using multidimensional arrays. So any advice or tips on how to start creating this function?
Are the width and height dimensions always going to be equal? For example, width = 4, height = 4.
Are they always going to be divisible by two?
Is n always going to be divisible by two?
Last edited on
Topic archived. No new replies allowed.