Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing an array

Tags:

java

arrays

I'm supposed to resize an image given to me by half using arrays. I have no idea where to begin. I'm given a function

public static int[][] resizeImage(int[][] original, int newWd, int newHt) 

and I'm supposed to use 2d arrays to map pixels from original to new image. Not sure if I'm giving enough info. I don't want the answer, just a hint or starting point, because I'm just not sure how to even start with this.

like image 480
Snowman Avatar asked Dec 03 '22 04:12

Snowman


1 Answers

Ok, assuming a 100x100 image, if you had a blue pixel at [0,0] and a red pixel at [99][99], after the resizing where would you expect these pixels to be?

like image 195
Tony Ennis Avatar answered Dec 21 '22 02:12

Tony Ennis