BufferedImage getRGB vs Raster getSample
问题 I am trying to do some image processing in Java. I used ImageIO library for reading and writing images. I can read the image pixel value in two ways as follows (there might be other methods which do not know). Using BufferedImage's getRGB method: pixel = image.getRGB(x,y); Using Raster's getSample method: WritableRaster raster = image.getRaster(); pixel = raster.getSample(x,y,0); What is the difference in the above two approaches? 回答1: 1: The first approach will always return a pixel in int