Blixinator
By: a guest | Feb 9th, 2010 | Syntax:
Java | Size: 1.23 KB | Hits: 13 | Expires: Never
import java.awt.image.*;
import javax.imageio.ImageIO;
import java.io.*;
public class AllRGB
{
{
AllRGB prog = new AllRGB();
prog.
bi = ImageIO.
read(new File("<FILE PATH>"));
int red;
int green;
int blue;
int width = prog.bi.getWidth();
int height = prog.bi.getHeight();
int reds[] = new int[256];
int greens[] = new int[256];
int blues[] = new int[256];
for(int a=0; a<256; a++)
{
reds[a]=0;
greens[a]=0;
blues[a]=0;
}
int RGB;
for(int a=0; a<width; a++)
{
for(int b=0; b<height; b++)
{
RGB = prog.bi.getRGB(a,b);
//System.out.println(RGB);
red = (RGB >> 16) & 0xFF;
green = (RGB >> 8) & 0xFF;
blue = RGB & 0xFF;
reds[red]++;
greens[green]++;
blues[blue]++;
}
}
boolean flag = true;
for(int a=0; a<256; a++)
{
System.
out.
println("R: " + reds
[a
] + " G: " + greens
[a
] + " B: " + blues
[a
]);
if(reds[a]!=65536 || greens[a]!=65536 || blues[a]!=65536)
flag = false;
}
}
}