Share Pastebin
Guest
Public paste!

Blixinator

By: a guest | Feb 9th, 2010 | Syntax: Java | Size: 0.76 KB | Hits: 48 | Expires: Never
Copy text to clipboard
  1. import java.awt.image.*;
  2. import javax.imageio.ImageIO;
  3. import java.io.*;
  4. import java.util.*;
  5.  
  6. public class AllRGB
  7. {
  8.         public BufferedImage bi;
  9.  
  10.         public static void main(String[] args) throws IOException
  11.         {
  12.                 AllRGB prog = new AllRGB();
  13.  
  14.                 prog.bi = ImageIO.read(new File("<FILE PATH>"));
  15.        
  16.                 int width = prog.bi.getWidth();
  17.                 int height = prog.bi.getHeight();
  18.  
  19.                 int RGB;
  20.  
  21.                 boolean colors[] = new boolean[256*256*256];
  22.  
  23.  
  24.                 boolean usesAllRGB = true;
  25.  
  26.                 for(int a=0; a<width; a++)
  27.                 {
  28.                         for(int b=0; b<height; b++)
  29.                         {
  30.                                 RGB = prog.bi.getRGB(a,b);
  31.                                 if(colors[-RGB-1]==false)
  32.                                         colors[-RGB-1]=true;
  33.                                 else
  34.                                 {
  35.                                         a=width;
  36.                                         b=height;
  37.                                         usesAllRGB=false;
  38.                                 }
  39.                         }
  40.                 }
  41.  
  42.                 System.out.println(usesAllRGB);
  43.         }
  44.  
  45. }