Skip to content

Instantly share code, notes, and snippets.

@thirdwing
Created July 1, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thirdwing/fdac90fd3a14967c40e79aef814deb47 to your computer and use it in GitHub Desktop.
Save thirdwing/fdac90fd3a14967c40e79aef814deb47 to your computer and use it in GitHub Desktop.
//java -Djava.awt.headless=true
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Main {
public static void main(String[] args) throws IOException {
// write your code here
BufferedImage img = ImageIO.read(new File("/Users/qkou/Desktop/Dot_Blot.jpg"));
byte[] pixels = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
System.out.println(pixels.length);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment