int rlen = pixels[0].length / 2;
int clen = pixels.length / 2;
int[][] temp = new int[rlen][clen];
for (int row = 0; row < temp.length; row++)
{
for (int col = 0; col < temp[0].length; col++)
{
temp[row][col] = pixels[col * 2][row * 2];
}
}
pixels = temp;
for some reason when i run it, it does shrink the picture but it also rotate it...can someone please help me? thx
1 reply to this topic
#1
Posted 25 April 2011 - 10:22 PM
i've been asked to write a code to shirk a picture by 1/2 the size...here's my code:
|
|
|
#2
Posted 26 April 2011 - 05:40 AM
temp[row][col] = pixels[col * 2][row * 2];You switched your rows and columns in this line. That's why it's rotating.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









