Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pixel = img.getRGB(x, y);
- R = (pixel & 0x00ff0000) >> 16;
- G = (pixel & 0x0000ff00) >> 8;
- B = (pixel & 0x000000ff);
- it = (float)(0.299*R + 0.587*G + 0.114*B);
- i = Math.round(it);
- R = i >> 16;
- G = i >> 8;
- B = i;
- novy = R|G|B;
- img.setRGB(x, y, novy);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement