import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
new AudioPlayDemo();
File file = new File("3.jpg");
BufferedImage bufImg = null;
try {
bufImg = ImageIO.read(file);
} catch (IOException e) {
e.printStackTrace();
}
Image img = (Image)bufImg;
int width = img.getWidth(null);
int height = img.getHeight(null);
int[] pixels = new int[width * height]; //图片的像素数组
PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pixels, 0,
width);
try {
pg.grabPixels();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
import javax.imageio.ImageIO;
public class Picture{
new AudioPlayDemo();
File file = new File("3.jpg");
BufferedImage bufImg = null;
try {
bufImg = ImageIO.read(file);
} catch (IOException e) {
e.printStackTrace();
}
Image img = (Image)bufImg;
int width = img.getWidth(null);
int height = img.getHeight(null);
int[] pixels = new int[width * height]; //图片的像素数组
PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pixels, 0,
width);
try {
pg.grabPixels();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}