fork download
  1. import java.awt.*;
  2. import java.awt.image.*;
  3. import java.io.*;
  4. import javax.imageio.*;
  5.  
  6. class Main {
  7. private void doIt(String fileName) {
  8. BufferedImage bi = null;
  9. try {
  10. bi = ImageIO.read(new File(fileName));
  11. int width = bi.getWidth();
  12. int height = bi.getHeight();
  13. for(int x=0; x<width; x++) {
  14. for(int y=0; y<height; y++) {
  15. int argb = bi.getRGB(x, y);
  16. int a = (argb >>> 24) & 0xff;
  17. int r = (argb >>> 16) & 0xff;
  18. int g = (argb >>> 8) & 0xff;
  19. int b = argb & 0xff;
  20. if(r == 0xff && g == 0 && b == 0) {
  21. System.out.printf("%d, %d%n", x, y);
  22. }
  23. }
  24. }
  25. } catch(IOException ex) {
  26. ex.printStackTrace();
  27. }
  28. }
  29.  
  30. public static void main(String[] args) {
  31. new Main().doIt(args[0]);
  32. }
  33. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty