Share Pastebin
Guest
Public paste!

Blixinator

By: a guest | Feb 9th, 2010 | Syntax: Java | Size: 1.10 KB | Hits: 83 | Expires: Never
Copy text to clipboard
  1. import java.awt.image.*;
  2. import javax.imageio.ImageIO;
  3. import java.io.*;
  4.  
  5. public class AllRGB
  6. {
  7.         public BufferedImage bi;
  8.         public RenderedImage ri;
  9.  
  10.  
  11.         public static void main(String[] args) throws IOException
  12.         {
  13.                 AllRGB prog = new AllRGB();
  14.  
  15.         prog.bi = ImageIO.read(new File("<FILE PATH>"));
  16.  
  17.                 int red;
  18.                 int green;
  19.                 int blue;
  20.  
  21.                 int width = prog.bi.getWidth();
  22.                 int height = prog.bi.getHeight();
  23.  
  24.                 int reds[] = new int[256];
  25.                 int greens[] = new int[256];
  26.                 int blues[] = new int[256];
  27.  
  28.                 for(int a=0; a<256; a++)
  29.                 {
  30.                         reds[a]=0;
  31.                         greens[a]=0;
  32.                         blues[a]=0;
  33.                 }
  34.  
  35.                 int RGB;
  36.  
  37.  
  38.                 for(int a=0; a<width; a++)
  39.                 {
  40.                         for(int b=0; b<height; b++)
  41.                         {
  42.                                 RGB = prog.bi.getRGB(a,b);
  43.                                 //System.out.println(RGB);
  44.                                 red = (RGB >> 16) & 0xFF;
  45.                                 green = (RGB >> 8) & 0xFF;
  46.                                 blue = RGB & 0xFF;
  47.                                 reds[red]++;
  48.                                 greens[green]++;
  49.                                 blues[blue]++;
  50.                         }
  51.                 }
  52.  
  53.                 boolean flag = true;
  54.  
  55.                 for(int a=0; a<256; a++)
  56.                 {
  57.                         if(reds[a]!=65536 || greens[a]!=65536 || blues[a]!=65536)
  58.                                 flag = false;
  59.                 }
  60.  
  61.                 System.out.println(flag);
  62.  
  63.  
  64.  
  65.         }
  66.  
  67. }